![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
h
main.cpp
- Committer:
- davidotitoju
- Date:
- 2018-01-09
- Revision:
- 0:67db5ce17397
File content as of revision 0:67db5ce17397:
* Function Name : main * Description : Main program. *******************************************************************************/ int main(void) //Main function { initgpio(); int k=0; char a[]="WWW.EEHERALD.COM"; char b[]="EMBEDDED SYSTEMS"; GPIOC->BRR=RS; //Initialize RS=0 for selecting instruction Send GPIOC->BRR=RW; // Select RW=0 to write Instruction/data on LCD GPIOC->BSRR=EN; // EN=1 for unlatch. (used at initial condition) delay_ms(10); s_init(); //Call Instruction Select routine GPIOA->ODR=0x0001; // Clear Display, Cursor to Home s_latch(); //Latch the above instruction GPIOA->ODR=0x0038; // Display Function (2 rows for 8-bit data; small) s_latch(); //Latch this above instruction 4 times s_latch(); s_latch(); s_latch(); GPIOA->ODR=0x000E; // Display and Cursor on, Cursor Blink off s_latch(); //Latch the above instruction GPIOA->ODR=0x0010; // Cursor shift left s_latch(); //Latch the above instruction GPIOA->ODR=0x0006; // Cursor Increment, Shift off s_data(); //Change the input type to Data.(before it was instruction input) s_latch(); //Latch the above instruction for(k=0;a[k];k++) { GPIOA->ODR=a[k]; //It will send a[0]='P' as = '0x0050' on Port A. s_latch(); //Latch the above instruction only once. Or it will clone each character twice if you latch twice. } GPIOC->BRR=RS; //Initialize RS=0 for selecting instruction Send GPIOC->BRR=RW; // Select RW=0 to write Instruction/data on LCD GPIOC->BSRR=EN; // EN=1 for unlatch. (used at initial condition) delay_ms(10); GPIOA->ODR=0x00C0; // Move cursor to beginning of second row s_latch(); //Latch the above instruction s_data(); //Change the input type to Data.(before it was instruction input) for(k=0;b[k];k++) { GPIOA->ODR=b[k]; //It will send b[0]='E' as = '0x0044' on Port A. s_latch();//Latch the above instruction only once. Or it will clone each character twice if you latch twice. } s_init(); }