This is a test program for TEXT LCD (HD44780) , 40 char x 2 lines.
Fork of Text_LCD_control by
main.cpp
- Committer:
- PedroS1989
- Date:
- 2015-03-17
- Revision:
- 1:183b7d2bea01
- Parent:
- 0:171b4ca846a6
File content as of revision 1:183b7d2bea01:
//AUTOR: Pedro Santos //DATA: 18/12/2014 //NOTAS: http: //CODIGO PARA: programa de teste para entradas e saidas da placa kl25Z #include "mbed.h" #include "TextLCD.h" //#include "Timer_ps.h" //******************************************************************** //******************************************************************** //DEFINIÇÃO DE ENTRADAS E SAIDAS USADAS NO PROGRAMA //SAIDAS DIGITAIS DigitalOut led1 (PTE2); DigitalOut led2 (PTE3); DigitalOut led3 (PTE4); DigitalOut led4 (PTE5); DigitalOut led_r (LED1); //LED on board DigitalOut led_g (LED2); //LED on board DigitalOut led_b (LED3); //LED on board //******************************************************************** //ENTRADAS DIGITAIS DigitalIn tecla1 (PTE20); DigitalIn tecla2 (PTE21); DigitalIn tecla3 (PTE22); DigitalIn tecla4 (PTE23); //******************************************************************** //******************************************************************** //Initial condictions: void initial_value_ports(){ led_r=1; led_g=1; led_b=1; led1=0; led2=0; led3=0; led4=0; } //******************************************************************** //******************************************************************** //Definição de pinos do LCD 16x2: TextLCD lcd(PTC6, PTC5, PTC4, PTC3, PTC0, PTC7); // rs,rw,e,d0,d1,d2,d3,16char's x 2 lines int main() { initial_value_ports(); lcd.cls(); //Clear lcd lcd.locate(0,0); lcd.printf(" Teste LCD 16x2 "); lcd.locate(0,1); lcd.printf("* Pedro Santos *"); while(1){ led_b = 0; wait(0.1); //Wait 100ms led_b = 1; wait(0.1); //Wait 100ms lcd.locate(0,0); lcd.printf(" Teste LCD 16x2 "); lcd.locate(0,1); lcd.printf("* Pedro Santos *"); led_g = 0; wait(0.1); //Wait 100ms led_g = 1; wait(0.1); //Wait 100ms wait(1); lcd.locate(0,1); lcd.printf(" Teste LCD 16x2 "); lcd.locate(0,0); lcd.printf("* Pedro Santos *"); wait(1); led_r = 0; wait(0.1); //Wait 100ms led_r = 1; wait(0.1); //Wait 100ms } }