Matrix Orbital 0821 driver questions
hydoskee
Posts: 10
This is my first time trying to write something like this, but I have a Matrix Orbital 0821 display that I'm trying to interface with the propeller chip.
The data sheet for the LCD is here: www.matrixorbital.ca/manuals/LCDVFD_series/LCD0821/LCD0821_140.pdf
I have a few questions about how to go about this project:
1. Is the rx/tx on the LCD -> Prop side necessary, or can I get by using just the Prop tx -> rx LCD connection.
2. What's the proper propeller syntax/object to send byte data? For example, the BASIC command to clear the screen is PRINT#1,chr$(254);chr$(88), and I'm not 100% sure how that translates to spin. I tried making a DAT block and BYTE objects containing these, and then using Simple Serial's tx method to put it up, but I just got jibberish.
Thanks for any suggestions or resources you can point me to!
The data sheet for the LCD is here: www.matrixorbital.ca/manuals/LCDVFD_series/LCD0821/LCD0821_140.pdf
I have a few questions about how to go about this project:
1. Is the rx/tx on the LCD -> Prop side necessary, or can I get by using just the Prop tx -> rx LCD connection.
2. What's the proper propeller syntax/object to send byte data? For example, the BASIC command to clear the screen is PRINT#1,chr$(254);chr$(88), and I'm not 100% sure how that translates to spin. I tried making a DAT block and BYTE objects containing these, and then using Simple Serial's tx method to put it up, but I just got jibberish.
Thanks for any suggestions or resources you can point me to!
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
I was getting SOME garbage on the LCD when I was using simple_serial and 3.3v, so I suspect the solution is likely that I need to use the FullDuplex library.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
As for that:
Is an RX pin required, or can i get away with only Propeller tx -> LCD rx connected?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
The clear screen command is "send decimal 254, send decimal 88", and so I run
(where Serial is a full duplex serial object)
Serial.dec(254)
Serial.dec(88)
and the screen is cleared.
The data sheet says to run 254, 70 to get an "F" on the screen.
When I run
Serial.dec(254)
Serial.dec(70)
i get
" % $"
Other letters are equally confusing, but F had characters I could easily print using a qwerty.
I'm running in mode 0 (for the start function), and 19_200.
Any help is very appreciated!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
2. I tried that too, but I was getting lightly more nonsensical stuff, so I assumed that the line in the datasheet "254 must be printed before each command" applied to letters as well.
try Serial.tx('F')
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
When you send:
Serial.dec(254)· ' Command
Serial.dec(88)··· ' Clear Display
What is actually going to the 0821 is, in hex:
0x32 0x35 0x34 0x38 0x38
I believe you want to send:
Serial.tx(254)·· ' Command
Serial.tx(88)···· ' Clear Display
Which will send, in Hex:
0xFE 0x58
Attached is an·archive that I used a Matrix Orbital LCD2041 in, I believe the commands are the same for the LCD0821. The LCD2041 is a 4 line by 20 character display, so you will need to modify the program a bit to fit the line and character count for your display.
Also I believe all Matrix Orbit displays expect RS-232 serial data, so if you are not using a level shifter on the Propeller side to send data to the display be sure that the data that the Propeller is sending is INVERTED, and at the correct baud rate that the display is expecting. On my setup, data from the Propeller is going directly to the display, so I'm using the INVERTED option in the serial object and the display is set for 19200.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike
Post Edited (Mike Cook) : 6/13/2007 11:47:52 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Also, Serial.tx('F') generates an error (in syntax).
{{Debug For Matrix Orbital LCD0821}}
OBJ
Serial : "FullDuplexSerial"
PUB Main
Serial.start(17,18,1,19_200)
Serial.tx254)
Serial.tx(88)
Serial.stop
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Try the following.........
I don't see the following in the code you posted, either you left it out, of your post,·to be brief or you are not using it. I believe you will need a crystal to use the serial object. (Paul correct me If I'm Wrong!) I could not get it to work until these two lines were added, i.e. I was getting garbage characters on the display:
Note: I'm using a Propeller ProtoBoard w/5 MHz crystal and a LCD2041 display. The commands for your LCD0821 should be similar to the LCD2041
Here's the rest of the code:
I've attached this in the test.spin file, try this and see if it helps, works on my LCD2041
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike
Post Edited (Mike Cook) : 6/15/2007 1:18:38 AM GMT
Although, I did after you mentioned that, and I was still getting jibberish. I have the following setup:
I'm using this as my crystal www.sparkfun.com/commerce/product_info.php?products_id=540
And when I run it, I get a little guy that looks like he shot me once in space invaders. No cleared screen, though.
Thank for the ongoing help troubleshooting this.
Three things that might clear this up.
1. Your LCD0821 what pin, on the propeller chip, is it connected to and is it set for TTL or RS-232 serial? I'm assuming your display is set for RS-232 serial and connected to pin 18 of the Propeller. If that the case in the following line:
Serial.start(17,18,1,19_200)
Is only inverting pin 17 and not pin 18. To invert pin 18 use:
Serial.start(17,18,2,19_200)
or to invert both RX/TX use:
Serial.start(17,18,3,19_200)
2. Paul will have to comment on the 32KHz crystal, I've always used the suggested 5Mhz crystal. Not sure if FullDuplexSerial.spin has a frequency limitation/requirement.
3. If you use Serial.stop, immediately after sending data to FullDuplexSerial.spin, from what I have found the object will be stopped before it has a chance to completely output the serial data. In the above attached test.spin, that was the case so that's why it was commented out.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike
Post Edited (Mike Cook) : 6/15/2007 2:35:58 PM GMT
The problem with using the internal clock for serial is in order for it to function properly you need to measure what the RC circuit is oscillating at, this varies from chip to chip.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Post Edited (Paul Baker (Parallax)) : 6/15/2007 4:49:58 PM GMT
It works perfectly now, and I can set about modifying Mike's code to fit my LCD screen, or if I even wanted to code up my own from scratch to get a little more familiar with the Spin language, I'm at a very good place to do that.
Thanks so much for all your help!
Follows is my code that actually works!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.