myLCD - #include <util/delay.h> #define #define...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <util/delay.h> # #define sbi(sfr,bit) sfr|=_BV(bit) #define cbi(sfr,bit) s #define EN 2 #define RW 1 #define RS 0 #define CTRL PORTD #define DDR_CTRL DDRD D #define DATA_O PORTD #define DATA_I PIND #define DDR_DATA DDRD /* #define LCD8BIT #define DATA_O PORTD #define DATA_I PIND #define DDR_DATA DDRD */ * char Read2Nib(){ char HNib, LNib; DATA_O |=0xF0; D sbi(CTRL,EN); //enable s DDR_DATA &=0x0F; D HNib=DATA_I & 0xF0; cbi(CTRL,EN); //disable c sbi(CTRL,EN); //enable LNib = DATA_I & 0xF0; cbi(CTRL,EN); //disable LNib>>=4; return (HNib|LNib); } void Write2Nib(uint8_t chr){ v uint8_t HNib, LNib, temp_data; u temp_data=DATA_O & 0x0F; t HNib=chr & 0xF0; LNib=(chr<<4) & 0xF0; L DATA_O =(HNib |temp_data); D sbi(CTRL,EN); //enable cbi(CTRL,EN); //disable c DATA_O =(LNib|temp_data); D sbi(CTRL,EN); //enable cbi(CTRL,EN); //disable } void Write8Bit(uint8_t chr){ DATA_O=chr; //out 8 bits to DATA Line sbi(CTRL,EN); //enable cbi(CTRL,EN); //disable }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
} void wait_LCD(){ v #ifdef LCD8BIT
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

myLCD - #include &lt;util/delay.h&gt; #define #define...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online