1602FLCD
Fork of TextLCD by
LCD.cpp@1:6c3062de234b, 2012-11-02 (annotated)
- Committer:
- tijofrancis12
- Date:
- Fri Nov 02 14:29:13 2012 +0000
- Revision:
- 1:6c3062de234b
- Parent:
- TextLCD.cpp@0:de90b67b2bca
interface of pc1602Fdisplay
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tijofrancis12 | 1:6c3062de234b | 1 | #include "LCD.h" |
tijofrancis12 | 1:6c3062de234b | 2 | DigitalOut RS(p19); |
tijofrancis12 | 1:6c3062de234b | 3 | DigitalOut E(p20); |
tijofrancis12 | 1:6c3062de234b | 4 | BusOut data(p21,p22,p23,p24); |
tijofrancis12 | 1:6c3062de234b | 5 | void toggle_enable(void){ |
tijofrancis12 | 1:6c3062de234b | 6 | E=1; |
tijofrancis12 | 1:6c3062de234b | 7 | wait(0.001); |
tijofrancis12 | 1:6c3062de234b | 8 | E=0; |
tijofrancis12 | 1:6c3062de234b | 9 | wait(0.001); |
pprasad7 | 0:de90b67b2bca | 10 | } |
tijofrancis12 | 1:6c3062de234b | 11 | void LCD_init(void){ |
tijofrancis12 | 1:6c3062de234b | 12 | wait(0.02); |
tijofrancis12 | 1:6c3062de234b | 13 | RS=0; |
tijofrancis12 | 1:6c3062de234b | 14 | E=0; |
tijofrancis12 | 1:6c3062de234b | 15 | data=0x2; |
tijofrancis12 | 1:6c3062de234b | 16 | toggle_enable(); |
tijofrancis12 | 1:6c3062de234b | 17 | data=0x8; |
tijofrancis12 | 1:6c3062de234b | 18 | toggle_enable(); |
tijofrancis12 | 1:6c3062de234b | 19 | data=0x0; |
tijofrancis12 | 1:6c3062de234b | 20 | toggle_enable(); |
tijofrancis12 | 1:6c3062de234b | 21 | data=0xF; |
tijofrancis12 | 1:6c3062de234b | 22 | toggle_enable(); |
tijofrancis12 | 1:6c3062de234b | 23 | data=0x0; |
tijofrancis12 | 1:6c3062de234b | 24 | toggle_enable(); |
tijofrancis12 | 1:6c3062de234b | 25 | data=0x1; |
tijofrancis12 | 1:6c3062de234b | 26 | toggle_enable(); |
pprasad7 | 0:de90b67b2bca | 27 | } |
tijofrancis12 | 1:6c3062de234b | 28 | void display_to_LCD(char value){ |
tijofrancis12 | 1:6c3062de234b | 29 | RS=1; |
tijofrancis12 | 1:6c3062de234b | 30 | data=value>>4; |
tijofrancis12 | 1:6c3062de234b | 31 | toggle_enable(); |
tijofrancis12 | 1:6c3062de234b | 32 | data=value; |
tijofrancis12 | 1:6c3062de234b | 33 | toggle_enable(); |
pprasad7 | 0:de90b67b2bca | 34 | } |
pprasad7 | 0:de90b67b2bca | 35 | |
pprasad7 | 0:de90b67b2bca | 36 | |
pprasad7 | 0:de90b67b2bca | 37 |