Convenience routines for an I"C connected LCD display. Handy things like taking cursor to home, positioning cursor, clearing display, writing strings etc
Diff: jtlcd.cpp
- Revision:
- 0:8f724a47a820
- Child:
- 1:2ded47079af1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jtlcd.cpp Wed Nov 07 21:58:22 2012 +0000 @@ -0,0 +1,61 @@ +#include "mbed.h" +#include "jtlcd.h" + +I2C i2c(p28, p27); // sda, scl +void lcdinit() +{ + + i2c.start(); + i2c.write(Slave); + i2c.write(0x00); + i2c.write(0x38); + wait(0.01); + i2c.write(0x39); //i assume now we juyst need data? + wait(0.01); + i2c.write(0x14); + i2c.write(0x74); + i2c.write(0x54); + i2c.write(0x6f); + i2c.write(0x0c); + i2c.write(0x01); + i2c.write(0x06); + wait(0.01); + i2c.stop(); + + +} + +void lcdclear() +{ + i2c.start(); + i2c.write(Slave); + i2c.write(0x00); + i2c.write(0x01); + i2c.stop(); + wait(0.2); +} + +void test() +{ + + i2c.start(); + i2c.write(Slave); + i2c.stop(); + wait(0.2); +} + + +void Show(char *text) +{ + int n,d; + d=0x00; + int length = strlen(text); + i2c.start(); + i2c.write(Slave); //Slave=0x78 + i2c.write(Datasend);//Datasend=0x40 + for(n=0;n<length;n++){ + i2c.write(*text); + ++text; + } + i2c.stop(); +} \ No newline at end of file