NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » lcd.c bitwise operations
January 10, 2011 by kemil |
Hi Guys, Can I just check I am following through the binary operations of the lcd_home() function found in the lcd.c source code correctly.
IS this first part correct? If not could you point out what I am doing wring and what is should be.... Thanks for your help kemil |
---|---|
January 10, 2011 by bretm |
~(1<<PD7) is 01111111, not 00000000 lcd_write_byte(0x02) is equivalent to lcd_write_nibble(0) followed by lcd_write_nibble(2) "So taking 0b11000011 as PORTD..." It's not. PD7 is low because of lcd_set_type_command. PD6 is low because it's only high during that first delay_us(1) call in lcd_write_nibble. PD1 and PD0 may or may not be low--those are not controlled by lcd.c. So without seeing the rest of your program I would say that PORTD at that point is 000000XX where X=don't know. Then it goes to 010000XX for 1us, and then back to 000000XX. And then, when lcd_write_nibble(2) happens, PORTD goes to 000010XX momentarily, and then 010010XX for 1us, and then back to 000010XX which is where lcd_write_byte(0x02) leaves it. |
Please log in to post a reply.
Did you know that you can see each keypress on a computer keyboard on an oscilloscope? Learn more...
|