I have written a code in C18 for PIC 18F452 to drive the LCD using the serial cable. I'm able to display a line which states if an LED is on/off. This works just fine, the problem is that at the end of the text in row 1 there is a box that doesn't go away. RB0 LED IS: OFF[] or RB0LED IS: ON[][] (when the button on RA4 is pressed) Any help will be appreciated. Thanks.
Do you notice when this box first appears? Maybe comment out for now the while(1) code, and see if clear screen 0xFE, 0x58 does clear the screen.
Also, you might want to make sure the your code does actually what you expect it to do. Try connecting your output to the PC serial port using our uProject eval software to see all the characters being sent out. This means you will be disconnecting the display temporarily. If your USART is not in RS232 levels, you will have to have a transceiver before connecting the PC's serial port.
Best Regards,
Raquel Malinis
Design and Development
Matrix Orbital
the clear command works just fine and the lcd is able to display text. I was able to fix the problem i was having before using the printf command. anyways there was an F being left of when the button was pressed and message displayed ONF. I added a space to ON and fixed that, not sure if that is the right way. I think I have to clear the screen when pressing the button.
The other thing is that I'm trying to display text on the second row and that's not working for me. Not sure if the syntax to send the command is right.
There is a delay between each data that is being sent to the LCD. Is there a specific delay at which data has to be sent to the LCD??...By the way this works just fine, but I think it could be better.
After days of playing around with the LCD and pic micro in serial I ithink your documentation needs some work. Some of your commands need before and after delays to get it working. The information might be somewhere but I can't find it.
The delay you have added, if you go back and take them one by one, you will find is not necessary. When you were running a tight loop like you had on your second code post, then it would be necessary.
The displays are meant for the human eye to decipher changes and be able to read. You need not to run it very quickly, otherwise the info displayed will be unintelligible.
We do not specify the delays on the manual because the need becomes totally subjective to the application. If you were not running a tight loop with both if and else constructs writing to the display at the same time ('ON' and 'OFF' in your code) you will find these delays are definitely not necessary.
Thanks,
Raquel Malinis
Design and Development
Matrix Orbital
After every writeUSART() command you will need a while (BusyUSART());
The PIC's hardware USART has no buffer, so when you write two things back to back it will hose things.