Unlike Henrik, I happen to LOVE autos. What I would suggest is to set your UART Special Function Registers, add the DEFINEs in your header, and use the HSERIN/OUT commands for your serial communications. This puts communications things in the background. When working with LCDs I like to use a PORT for data when I can afford the MCU pins; this means PORTx is dedicated to LCD communication. Setting a PORT to a variable value only takes one instruction cycle. ENABLE = 1 takes one instruction cycle. How long you hold ENABLE High (I use 8 uS) may interfere with other activities.
I suggest you prioritize your activities, use INTERRUPTs for the highest priorities, then use normal lines of code for things like the LCD, you should be good. Like Henrik said, you can also calculate how long it takes for various functions (like LCDOUT) and place them in your code so they don't interfere with other functions. I experienced something where using interrupts the processor would occasionally go into an unexpected RESET. I created a bit variable and cleared it in the normal code and set it in the Interrupt Routine. The Main loop would DO/LOOP WHILE until the Interrupt Routine did its thing and cleared that bit. The Main Loop would then set the bit, do other things, then DO/LOOP until it got the clear bit. You might try throttling (gating) your Main loop to correspond with your ISR.




Bookmarks