Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: s_Lcd.cpp
- Revision:
- 3:f5576943e216
- Parent:
- 2:5d8d5291b4cd
- Child:
- 4:1f72df1a88e0
diff -r 5d8d5291b4cd -r f5576943e216 s_Lcd.cpp
--- a/s_Lcd.cpp Sat Oct 08 08:19:31 2011 +0000
+++ b/s_Lcd.cpp Sat Oct 08 23:51:33 2011 +0000
@@ -25,40 +25,37 @@
device.putc(0x55);
device.putc(0xD5);
device.putc(0xAA);
+ wait(0.1);
}
-void lcdprint( char data[98],int x,int y)
+void s_Lcdinit()
{
- unsigned char s;
- unsigned char x0H;
- unsigned char x0L;
- unsigned char y0H;
- unsigned char y0L;
- unsigned char datalen;
- x0H = x >> 8;
- x0L = x & 0xFF;
- y0H = y >> 8;
- y0L = y & 0xFF;
- datalen = strlen(data)+5;
+ device.baud(9600);
+ rst = 0; //Reset
+ wait(0.1);
+ rst = 1;
+ wait(0.1);
+ device.putc(0x55);//Back light On
+ device.putc(0x03);
+ device.putc(0x89);
+ device.putc(0x01);
+ device.putc(0x2C);
+ device.putc(0xB6);
+ device.putc(0xAA);
+ wait(0.1);
+ device.putc(0x55);// Clear
+ device.putc(0x02);
+ device.putc(0x80);
device.putc(0x55);
- device.putc(datalen);
- device.putc(0x0B); // command ASCII Print
- device.putc(x0H); //x upper 8bit
- device.putc(x0L); //x low 8bit
- device.putc(y0H); //y upper 8bit
- device.putc(y0L); //y low 8bit
- for(int a=0;a<strlen(data);a++)
- {
- device.putc(data[a]);
- s = s+data[a];
-// pc.printf("%x:",data[a]);
- }
- s = s+x0H+x0L+y0H+y0L+0x0B;
- device.putc(s);//sumcheck
+ device.putc(0xD5);
device.putc(0xAA);
-// pc.printf("print %x %x %x %x %x %d ",x0H,x0L,y0H,y0L,s,datalen);
+ wait(0.1);
+ lcdspeed();
+ wait(0.1);
+ device.baud(115200);
}
+
void color(int rgb)
{
int c1;
@@ -225,7 +222,8 @@
device.putc(sum);
device.putc(0xAA);
}
-void lcdput(unsigned char data,int x,int y)
+
+void lcdprint(char data[98],int x,int y)
{
unsigned char s;
unsigned char x0H;
@@ -237,7 +235,7 @@
x0L = x & 0xFF;
y0H = y >> 8;
y0L = y & 0xFF;
- datalen = 6;
+ datalen = strlen(data)+5;
device.putc(0x55);
device.putc(datalen);
device.putc(0x0B); // command ASCII Print
@@ -245,33 +243,14 @@
device.putc(x0L); //x low 8bit
device.putc(y0H); //y upper 8bit
device.putc(y0L); //y low 8bit
- device.putc(data);
- s = data+x0H+x0L+y0H+y0L+0x0B;
+ for(int a=0;a<strlen(data);a++)
+ {
+ device.putc(data[a]);
+ s = s+data[a];
+// pc.printf("%x:",data[a]);
+ }
+ s = s+x0H+x0L+y0H+y0L+0x0B;
device.putc(s);//sumcheck
device.putc(0xAA);
// pc.printf("print %x %x %x %x %x %d ",x0H,x0L,y0H,y0L,s,datalen);
}
-
-
-void s_Lcdinit()
- {
- device.baud(9600);
- rst = 0; //Reset
- wait(0.1);
- rst = 1;
- wait(0.5);
- lcdspeed();
- wait(0.1);
- device.baud(115200);
- device.putc(0x55);//Back light On
- device.putc(0x03);
- device.putc(0x89);
- device.putc(0x01);
- device.putc(0x2C);
- device.putc(0xB6);
- device.putc(0xAA);
- wait(0.1);
- cls();
-
- }
-