Paul van der Wielen
/
lc_display
Yet another I2C Text based LCD display program
Revision 2:91dec3d7903a, committed 2014-01-19
- Comitter:
- pwheels
- Date:
- Sun Jan 19 14:23:58 2014 +0000
- Parent:
- 1:d8767e2b8e7e
- Commit message:
- updated string to display command
Changed in this revision
diff -r d8767e2b8e7e -r 91dec3d7903a lc_display.h --- a/lc_display.h Wed Mar 09 07:05:29 2011 +0000 +++ b/lc_display.h Sun Jan 19 14:23:58 2014 +0000 @@ -181,14 +181,14 @@ } void _WriteLCD(int Cmd, char *par1, int par2) { - +// par2 != 0 -> use par2 else actual length of string int i; int j = 1000; i2c.start(); i2c.write(I2C_ADDR); i2c.write(Cmd & 0xff); // Set Command - for (i = 0; i < par2; i++) { + for (i = 0; i < (par2 != 0) ? par2 : strlen(par1); i++) { i2c.write(par1[i]); } i2c.stop();
diff -r d8767e2b8e7e -r 91dec3d7903a main.cpp --- a/main.cpp Wed Mar 09 07:05:29 2011 +0000 +++ b/main.cpp Sun Jan 19 14:23:58 2014 +0000 @@ -49,7 +49,10 @@ _WriteLCD(Delete, 1, 3, 4); _WriteLCD(SetCursor, 0x45); _WriteLCD(CharToLCD, 0x01); + _WriteLCD(SetCursor, 0x14); _WriteLCD(CharToLCD, 0x02); + _WriteLCD(SetCursor, 0x54); + _WriteLCD(CharToLCD, 0x30); _WriteLCD(Shift, 0, 0); // log to usb serial port, visible by Tera Term printf("Character ->%c<- at position %d, ram = %x\r\n", _ReadLCD(GetCharAtCur), _ReadLCD(GetCursorAdr), _ReadLCD(ReadRam));
diff -r d8767e2b8e7e -r 91dec3d7903a mbed.bld --- a/mbed.bld Wed Mar 09 07:05:29 2011 +0000 +++ b/mbed.bld Sun Jan 19 14:23:58 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912 +http://mbed.org/users/mbed_official/code/mbed/builds/4c0c40fd0593 \ No newline at end of file