Jump to content

BJH

EstablishedMember
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

0 Neutral

About BJH

  • Rank
    Newbrie
  1. I can confirm that Richard is correct about the problem with adding libraries that have spaces in their path under MPLAB-X. I have been trying to use the function uitoa_hex() from the compiler documentation and I experienced the same problem with the linker. I created a directory named 'C:\SB' and moved the library there, then added it to my project. Problem solved. MPLAB-X does actually warn you about spaces in directory names having the potential to cause problems. It seems these problems start to show up when you want to add libraries to the project. BJH.
  2. I solved my problem with the repeated characters by making proper use of the buffer. My test code rendered the buffer pointless as I was processing characters every single time an interrupt was generated. So I changed my interrupt service routine so that it only processes data when the buffer has more than 7 characters in it. Elsewhere in the ISR there is another piece of code which executes every time TIMER0 overflows (about once every 0.5 seconds), and in this part of the code I flush the buffer so that any data <7 characters long that is lingering there gets processed. Now I don't see the repeated characters issue.
  3. Okay, now that I've had some time to play with the UART driver, I'm experiencing an intermittent transmit problem. Below are two simple functions I've written to send RS232 data; one for sending a single character, and another for sending a message: void printc(unsigned char c) { uart1Tx©; } void printm(unsigned char* message) { int i = 0; while (message != '\0') { uart1Tx(message); i++; } } To test some things I decided to use my ISR to echo anything that was received over RS232. This way I can connect a terminal to it, type some data on the terminal, and this data should be echoed back to the screen: // UART1 Receive if (pir1.RC1IF) { if(uart1RxInterruptHandler()) { while (rxCnt != 0) { unsigned char data = uart1Rx(); if (data == 0xd) { printm("\r\n> "); } else { printc(data); } } } } This works quite well. Unfortunately, though, the code has a habbit of intermittently repeating a character twice. Here's the result of me typing the alphabet into the terminal a few times: > abbcdeffghijkklmmnopqrsttuvwxyzz > abbcddeefghijkklmmnopqrstuvwxyz > abcddefghijklmmnopqrsstuvwxyz > aabcdeefghhijklmnopqrstuvwxyz > abcdefghijklmnopqrstuvwxyz > abcddefghijklmnopqrstuvwxyz On the last two lines I typed really fast with no delay between characters. On the other lines I typed by pressing one single key at a time with a small delay. It seems that if I type really quickly, and therefore send data quite repetitively, it doesn't repeat any characters. Otherwise it intermittently repeats some transmitted characters. Has anyone else experienced this? Or does anyone have recommendations?
  4. Okay, I've got the uart driver working now. It took me a while to wrap my mind around how it's all supposed to work, mainly because I'm not too familiar with the use of templates. Thanks, BJH
  5. Ah okay, thanks for the explanation. I did consider line continuations but as C does not care about such things I didn't see why it would be needed. I didn't consider that #define statements would need to be one-liners, but obviously they would need to be. Cheers, Brian
  6. Hello all, I am trying to use the Sourceboost UART driver. I am in the process of reading the documentation so that I can get to grips with how to use it. I have encountered something that is confusing to me. On page 87 of the boostc manual that is supplied with the latest Sourceboost package, examples are given such as below: #define uart1TxInterruptHandler \ rs232TxInterruptHandler<PIR1,TX1IF,TXREG1,sizeof(txBuffer), \ TXSTA,TXEN,TXSTA,TRMT> Can someone tell me what the backslashes (\) are for? Also, with regard to the boostc manual, there seem to be differences between the manual supplied with the sourceboost package (boostc.pdf) and the one linked to on the website (http://www.sourceboost.com/Products/BoostC/Docs/boostc.pdf) Cheers all, BJH
×