fm101
Member level 5
hi,
I am trying to write C code for AVR microcontroller to send lower nibble via port B lower 4 pins as shown in figure below. My code to send data is also below but its not working. Can somebody tell me what i am doing wrong?
thanks
I am trying to write C code for AVR microcontroller to send lower nibble via port B lower 4 pins as shown in figure below. My code to send data is also below but its not working. Can somebody tell me what i am doing wrong?
thanks
C:
void lcdchar(uint8_t data){
PORTB = (PORTB & 0xF0) | (data & 0x0F); // send low nibble
PORTC &= ~RW; //send 0 for write operation
PORTC |= RS; //send 1 to select data register
latch();
PORTB = (PORTB & 0xF0) | (data>>4); // send high nibble
latch();
}