Parallax 4x16 LCD Help
Hello
i have a parallax 4x16 lcd and i have it working but i need to know how tosend text to the lcd. i currently have the Debug_LCD Driver but it seems to nothave the ability to send a fill string to the screen.
i have a parallax 4x16 lcd and i have it working but i need to know how tosend text to the lcd. i currently have the Debug_LCD Driver but it seems to nothave the ability to send a fill string to the screen.
Comments
Sorry for the lack of information, the project is developed on the propeller chip and i am using a propeller demo board.
CODE BELOW
{{ RFID Tag Side (remote client) }} CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 XBEE_DOUT_PIN = 1 XBEE_DIN_PIN = 2 XBEE_MODE = %0000 XBEE_BAUD = 9_600 LED_PIN = 20 LCD_PIN = 3 ' for Parallax 4x20 serial LCD on P0 LCD_BAUD = 19_200 LCD_LINES = 4 obj xb : "FullDuplexSerial" 'comms to XBee. xbobj : "XBee_Object_2" lcd : "debug_lcd" pst : "Parallax Serial Terminal" ' Serial communication object var long recv byte data[11] pub go | idx xb.start(XBEE_DOUT_PIN, XBEE_DIN_PIN, XBEE_MODE, XBEE_BAUD) 'start comms to XBee pst.Startrxtx(1, 30, 0, 9600)' Notice pin 0 is the Rx pin on this end. Pin 30 is used for transmitting to the serial terminal if lcd.init(LCD_PIN, LCD_BAUD, LCD_LINES) ' start lcd lcd.cursor(0) ' cursor off lcd.backLight(true) ' backlight on (if available) lcd.custom(0, @Bullet) ' create custom character 0 lcd.cls ' clear the lcd lcd.str(string("NODE", 13)) lcd.putc(0) ' display custom bullet character lcd.str(string("Recive", 13)) lcd.putc(0) lcd.str(string("Transmit", 13)) lcd.putc(0) 'main loop repeat ReciveData pub ReciveData pst.strinmax(@data, 1) waitcnt(clkfreq/100 + cnt) updateLcd(@data) pst.str(@data) pub Delay(mS) ' Delay in milliseconds waitcnt(clkfreq / 1000 * mS + cnt) PRI updateLcd(value) lcd.gotoxy(12, 1) lcd.str(value) ' print right-justified decimal value lcd.gotoxy(12, 2) lcd.str(value) ' print indicated (with $) hex DAT Bullet byte $00, $04, $0E, $1F, $0E, $04, $00, $00
http://www.parallax.com/Store/Accessories/Displays/tabid/159/CategoryID/34/List/0/SortField/0/Level/a/ProductID/51/Default.aspx
Data sheet
http://www.parallax.com/Portals/0/Downloads/docs/prod/audiovis/27976-7-9-ParallaxSerialLCD-v2.1.pdf
I was just typing this as you posted the datasheet:)
CODE SNIPPET
PRI updateLcd(value) lcd.gotoxy(12, 1) lcd.str(value) ' print right-justified decimal value lcd.gotoxy(12, 2) lcd.str(value) ' print indicated (with $) he
Lcd.str(@Value)
Or if you want to insert a string of text without a variable array, you could do this..
Lcd.str(string("What hath God wrought?"))
OR... Were you trying to display a decimal number as a value? If so, then you would need to change the line of code so that it will display a single byte/word/long of data as a ASCII string.. Like such
Lcd.dec(value)
lcd.dec(value)
That should give you what you want... Yeah, i thought that you wanted to do was send a string of characters from an array to the LCD. You just want to display a byte of data as a ascii string. The above should work. Sorry for the confusion:)
Consider a string is only a byte array, with the end of the sting identified by a 0. A "string" function returnd directly the address, and this is expected by the sting handling functions.
If you have the string in a DAT section you should use the @, same if you create a string as an array.
if you send
lcd.str(string("hello"))
does it work?
Massimo
"numbers" and "simple numbers" are a good solution. Simple numbers is less powerful but easier to use, and sometimes even better.
This way you have an already formatted string available.
if num is you simple numbers object,
lcd.str(num.dec(1234))
will do all the job for you. If you need more complex formatting decf and decx are available.
Massimo
Thanks