help
/
Info_2_TD
Diff: Partie_3/Exercice_2/LCD.cpp
- Revision:
- 0:4651c5d6ca1e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Partie_3/Exercice_2/LCD.cpp Thu Jun 25 16:30:18 2020 +0000 @@ -0,0 +1,49 @@ +/* +// LCD.cpp file +#include "LCD.h" +DigitalOut RS(p19); +DigitalOut E(p20); +BusOut data(p21, p22, p23, p24); +void toggle_enable(void){ + E.write(1); + wait(0.001); + E.write(0); + wait(0.001); +} +void LCD_init(void){ + wait(0.02); + RS.write(0); + E.write(0); + //function mode + data.write(0x2); + toggle_enable(); + data.write(0x8); + toggle_enable(); + //display mode + data.write(0x0); + toggle_enable(); + data.write(0xF); + toggle_enable(); + //clear display + data.write(0x0); + toggle_enable(); + data.write(0x1); + toggle_enable(); +} +//display function +void display_to_LCD(char value ){ + RS.write(1); + data.write(value>>4); + toggle_enable(); + data.write(value&0x0F); + toggle_enable(); +} + +void mafonction(char t[]){ + int i=0; + while(t[i]!='\0'){ + display_to_LCD(t[i]); + i++; + } +} +*/ \ No newline at end of file