LCD_RS is just defined to the right LATA pin, I'll do the same for LCD_DATA later.
So I tried to make an LCDNibble (like the 2 wire example has):
Code:
void LCDNibble(unsigned char n, unsigned char rs) {
//LATB &= 0xf0; // Clear lower 4 bits of port
//LATB ^= n; // Move nibble to port (COMMENTED FOR TESTING)
LATB = n;
LCD_RS = rs; // Set RS line
LCDEnable(); // Pulse EN line
}
I have tried with and without the temporary variable, e.g. calling like LCDNibble((c>>4)&0x0f, 0). However this displays "P`pp".
I'm really tempted to simply have two seperate functions that do their own port setting but there must be something funny that the compiler does which breaks it. Or maybe I've been really stupid!