Shop OBEX P1 Docs P2 Docs Learn Events
My new LCD display is still kicking my A**! — Parallax Forums

My new LCD display is still kicking my A**!

paysonbadboypaysonbadboy Posts: 81
edited 2005-03-09 04:38 in General Discussion
Hey guys. I know we talked about this thing a while back when I first got it form ebay.
So after it sat around for a few weeks I decided to put togther the el cheapo LCD display (Topway LMB162ABC) that·I got from somone on ebay. It was actually a company.

03-05-05_1531.jpg

I wired up the serial to parallel kit that came in pieces with this thing.




03-05-05_1533.jpg


03-05-05_1532.jpg

The pic is kind of crapy because I used my new camera phone.
Anyway the LCD initializes and displays some text that must be written in the Atmel chip for the serial to parallel converter. So that part works.



Anyway. Using the sample code from a pdf file·I finally found (maybe from a post from someone here)
I get the stamp to send out data to the single pin in of the conversion board but nothing ever happens. It doesn't even clear the screen.


Some of the commands seem to conflict with some other stuff I've found.
Anyway. Here's the sample code I tried, but doesn't work:


' Program: BPKDEMS2.BS2
' This program demonstrates fundamental techniques of driving
' BPI-216 serial LCDs in BASIC from the BASIC Stamp II. It assumes
' that the BPI-216 is connected to I/O pin P0 of the Stamp, and
' that it is set for 9600 bps.
' Start by defining some useful constants for the Backpack.
N9600 con $4054 ' Baudmode-9600 bps inverted. Use $40F0 for BS2-SX.
I con 254 ' Instruction prefix value.
CLR con 1 ' LCD clear-screen instruction.
LINE2 con 192 ' Address of 1st char of 2nd line.
L1_C7 con 135 ' Address of line 1, character 7.
' Now clear the screen in case there's text left from a previous
' run of the program. Note that there's a 1-second PAUSE prior to
' sending any data to the Backpack. This gives the Backpack plenty
' of time to initialize the LCD after power up.
pause 1000
serout 0,n9600,[noparse][[/noparse]I,CLR] ' Clear the LCD screen.
pause 1
serout 0,n9600,[noparse][[/noparse]"Hello World!"] ' Print message.
' Positioning the cursor requires sending the instruction prefix (ASCII
' 254, assigned the symbol "I") followed by an address.
serout 0,n9600,[noparse][[/noparse]I,LINE2,"..line 2"] ' Move to line 2 and print.
' Now we'll simulate a common application by printing a label on the
' screen and updating some data by positioning the cursor.
pause 2000 ' Wait 2 secs.
serout 0,n9600,[noparse][[/noparse]I,CLR] ' Clear the LCD screen.
pause 1
serout 0,n9600,[noparse][[/noparse]"Count:"] ' Print the label.
Again:
serout 0,n9600,[noparse][[/noparse]I,L1_C7] ' Move to line 1, character 7.
serout 0,n9600,[noparse][[/noparse]DEC b2," "] ' Print value of b2 followed by 2 spaces.
b2 = b2+1 ' Increment b2.
pause 200 ' Slow the loop down.
goto Again ' Repeat endlessly
Anyone know what could be wrong?
I've nver used a LCD diplay or had experience with serial data like this so I'm not sure if it could be something simple or nt.
I even tried it by changing the commands from inverted to normal and still nothing.


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.paysonarizona.net/

Comments

  • steve_bsteve_b Posts: 1,563
    edited 2005-03-05 23:49
    Hi payson,· howz that injector project coming?!



    Uhm, hard to tell from your pic...but are you just running the data line to the IC?· You might want to try running a ground over there too!



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://ca.geocities.com/steve.brady@rogers.com/index.html
    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-03-05 23:57
    Payson, great to here you got the LCD working, isn't it great when something works despite your initial doubts?
  • paysonbadboypaysonbadboy Posts: 81
    edited 2005-03-06 01:58
    Paul Baker said...
    Payson, great to here you got the LCD working, isn't it great when something works despite your initial doubts?
    Actually the problem is it is NOT working.

    It is working as far as initializing (or whatever) from theat AT89C2051 Atmel chip that is supposed to convert the serial data from the parallel data to the LCD module becuase whatever they have flashed into that Atmel chip is sending the text "16x2 LCD" and "Momentumfire".
    So at least·I know I got all the terminals correct from the Atmel chip·I bread boarded together to the LCD module.
    But when·I hook up the serial form the stamp module it doesn't do anything, not even clear the display.


    To answer Steve, there is 3 wires coming from the stamp education board. +5, Ground, and serial from pin 0
    Looking at the picture i see how you thought that. There are wires coming from VDD and VSS via some allegator jumper wires which drop down south of what's seen in the photo. It ALL is powered from that BOE.

    I have an old scope not worth much but I can see the data come from the stamp, but nothing from the Atmel chip to the LCD module. When·I first power the Atmel chip·and LCD module I get the quick stream of data going to the LCD module that brings up the initial text.


    Talking to my moms Husband (they live in Canada) he programs PIC chips. He doesn't use the stamp tho. He thinks it may be something with the program and will probably be something stupid.
    The code i pasted in here is what I got from a PDF file which should be for that module.

    I was hoping someone knows something about that.

    Oh yeah. The ATV EFI is on hold. Been my slower season at work last month and had to put it back together (stock) for the upcoming Dune Trip (next weekend).




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.paysonarizona.net/
  • steve_bsteve_b Posts: 1,563
    edited 2005-03-06 02:12
    Wonder if you setup is using the same protocol.
    There's a mitsubishi protocol (honestly don't remember the name of it)....but it's how you're uspposed to talk to the LCD...although, if the backpack is working with it then maybe it's fine!

    Anyhow, this is all I do to write stuff to the LCD

    n9600 CON $4054
    I CON 254
    CLR CON 1
    LINE2 CON 192
    L1_C7 CON 135


    SEROUT 3, n9600, [noparse][[/noparse]I,CLR]······························
    PAUSE 700
    SEROUT 3, n9600, [noparse][[/noparse]"78D Wind Display"]

    (I just snipped this from old code...)
    The pause was just something I put in for no real good reason!
    Maybe it's missing the serial....try putting the instruciton/clear line in a loop and see if it EVER clears!?
    Maybe change the baud rate around....could you be set to 2400?· Was that an option?· Any dipswitches on your backpack?!



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://ca.geocities.com/steve.brady@rogers.com/index.html
    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-03-06 03:32
    Sorry was on my way out the door when I posted, I just scanned the post and saw the LCD lit up, I assumed wrong.
  • paysonbadboypaysonbadboy Posts: 81
    edited 2005-03-06 15:40
    No biggie Paul. In my first pic I can see that it DOES look like that, and my moms Husband asked the same thing (is there a GROUND going back to the stamp)!


    Steve, I tried a few diff bauds, and nothing. I'll have to compare your code to what I have. It looks similar but I'll give it a try. It's probably something simple stopping the entire thing.

    I also wondered if since that ATmel had to be flashed, if IT could be mis programmed? That would not be so cool because then it would NEVER work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.paysonarizona.net/
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-03-06 16:27
    Ok I found your guy selling another one on ebay, the site he refers to for the details·is http://momentumfire.com/89.html and the spec sheet on that product is here http://momentumfire.com/spec/lmb162a.pdf I have to go into work (yeah on a sunday, its that time of the quarter again) so I don't have time to compare your code with the spec sheet, but I would start with something that does a very simple command like clear the screen, to get the com right, then build from there.

    Just a side note this guy bugs me, he talks about it being a "one wire serial interface" but in the spec he talks about the interface to the LCD controller being 4 or 8 bit data bus (page 12 of the pdf) the quality of products from hong kong since the return to the PRC has gone down the crapper. I just don't believe capitalism and communism can be mixed to produce an environment in which high tech companies produce·quality products. The corruption prevalent in all communist governments that still exist is like throwing·fertilizer on the worst parts of capitalism (think turn of the century baron type capitalism,·only worse)

    Post Edited (Paul Baker) : 3/6/2005 4:44:31 PM GMT
  • paysonbadboypaysonbadboy Posts: 81
    edited 2005-03-06 16:49
    Yikes.

    I do have that pdf file. It has specs but I didn't see any code examples in it at all :-(

    That copy and paste i did was from a diff pdf file someone here gave me for named 2x16xlcd.lcd
    As I looked more into it, it is actually for a diff manufacturer. Similar but maybe it doesn't work.


    the ONLY code I could find form the person I bought it from is this text file:
    Command format :

    1. Display a string
    Serout TxD, 9600, [noparse][[/noparse]"0", cr]
    Serout TxD, 9600, [noparse][[/noparse]"string", cr]

    2. Clear whole display
    Serout TxD, 9600, [noparse][[/noparse]"1", cr]

    3. Point cursor to upperline
    Serout TxD, 9600, [noparse][[/noparse]"2", cr]

    4. Point cursor to upperline
    Serout TxD, 9600, [noparse][[/noparse]"3", cr]

    5. Shiftlcd right
    Serout TxD, 9600, [noparse][[/noparse]"4", cr]

    6. Shiftlcd left
    Serout TxD, 9600, [noparse][[/noparse]"5", cr]

    7. Locate Cursor
    Serout TxD, 9600, [noparse][[/noparse]"6", cr]
    Serout TxD, 9600, [noparse][[/noparse]"x", cr] x is the row selection
    Serout TxD, 9600, [noparse][[/noparse]"y", cr] y is the colum selection

    8. Cursor off & no blinking
    Serout TxD, 9600, [noparse][[/noparse]"7", cr]

    9. Cursor off & blinking
    Serout TxD, 9600, [noparse][[/noparse]"8", cr]

    10. Cursor on & not blinking
    Serout TxD, 9600, [noparse][[/noparse]"9", cr]

    11. Cursor off & blinking
    Serout TxD, 9600, [noparse][[/noparse]"10", cr]

    12. Cursor go home position (row = upperline, column = 1)
    Serout TxD, 9600, [noparse][[/noparse]"11", cr]

    13. Put raw command code to LCD module
    Serout TxD, 9600, [noparse][[/noparse]"12", cr]
    Serout TxD, 9600, [noparse][[/noparse]"code", cr] where code is a 8-bit value

    14. Put raw data to LCD module
    Serout TxD, 9600, [noparse][[/noparse]"13", cr]
    Serout TxD, 9600, [noparse][[/noparse]"data", cr] where data is a 8-bit value


    I used some of them commands and replaced TxD with my pin out and it didn't even work to clear the screen either.
    Hmm....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.paysonarizona.net/
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-03-06 18:04
    After reading through the spec a bit more, I believe that is the spec sheet for the LCD display only, which means absolutely no information regarding the operation of the atmel chip (those paultry code examples don't count as documentation). How do you know how to even hookup the chip, did it come with a connection diagram (from your previous post I think you said it didn't). Do you have an oscilloscope or an analyzer to see whats going on on the lines? If it doesn't work, you can always implement your own serial to parallel interface. Or you can try to see if you can dump the contents of the atmel and check that, this would only work if they didn't program the security fuse. What atmel chip is it? If its not OTP you could reprogram it regardless of whether the security bit is programmed or not. Programming most atmel's is pretty straight forward, using an SPI interface or a simplified JTAG interface, places such as www.sparkfun.com sell all the versions of programming cables for cheap. But all this entails programming in assembler, something you may not want to do.
  • paysonbadboypaysonbadboy Posts: 81
    edited 2005-03-07 03:45
    Yeah I did find a schematic if you call it one:

    LCD%2016%20x%202%20serial%20to%20parallel%20chip.gif

    OK. The pin number 2 goes to my stamp. I had to wire in that chip (AT89C2051-24PI) onto a breadboard that came with it. The Atmel to LCD MUST be working because there is an initial text programmed into the Atmel that prints what you see in my pics when it initializes.

    Now my scope is OLD but·I can see the data to know it is there. After the LCD and Atmel starts there is no activity form the Atmel when i send the serial to the Atmel from the stamp.

    Now I'd think the Atmel being made for a Stamp (as implied by their advertisement) that it would run the typical stamp manual commands right???

    Anyway. I don't have an Atmel flash kit or know much about them except that I have some gadget I used in the past that would er, uh, do them smart cards. but we shouldn't talk about that kind of stuff here :-) Maybe i could take it apart and make it into an Atmel programmer since I did use programs that would flash to it? Who knows. It's famously called a T911 I think. It's sitting in my closet un used.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.paysonarizona.net/
  • RickBRickB Posts: 395
    edited 2005-03-07 15:31
    paysonbadboy:

    Are you sure the constant you have used for 9600 baud is correct? Is it inverted or not? Experiment with the stamps' baud mode command.

    Rick
  • paysonbadboypaysonbadboy Posts: 81
    edited 2005-03-08 05:09
    I did. i removed the n before the 9600 and removed the line "n9600 CON $4054
    " and nothing.


    I got a PM from someone here saying he bought the same thing and has had the same problem.


    Dang these things. You'd think since they ripped a pic of a stamp and SOLD it as using a stamp, it would RUN with the basic stamp LCD codes!
    ARRGHHH!

    Oh well. I'll plug around with it next time i have a few hours to play with it.
    Any more info or things to try would be appreciated as always.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.paysonarizona.net/
  • paysonbadboypaysonbadboy Posts: 81
    edited 2005-03-08 05:10
    Oh, how do them CON command work? I have not played with them at all.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.paysonarizona.net/
  • paysonbadboypaysonbadboy Posts: 81
    edited 2005-03-08 05:46
    Hey i got it to do something.

    Looking in the stamp manual i noticed it said something about ADDING numbers for diff baud rates and parity's. So when I entered the number 84 it started doing stuff. But what?

    With this program :

    '{$STAMP BS2} 'STAMP directive (specifies a BS2SX)

    Loop:

    SEROUT 0,84,[noparse][[/noparse]"5",CR]



    PAUSE 200
    GOTO Loop



    It starts up with the display that is programmed in my atmel and then scrolls it to the left one step (both lines at once) as the program loops.
    if i change the numbers in the brackets and quotes, it does diff things.

    so, using this format, does anyone know how to get it to print text???
    In the stamp manual it simply has it using text in the quotes...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.paysonarizona.net/
  • RickBRickB Posts: 395
    edited 2005-03-08 06:06
    I think the answer to your problem is in the manual. The code example the seller supplied oversimplifies the issue. STUDY the ser out command, especially how to calculate the constant necessary for 9600 and whether or not the data is to be inverted.

    Rick
  • paysonbadboypaysonbadboy Posts: 81
    edited 2005-03-08 06:30
    I got it going. Dang thing!



    03-07-05_2313.jpg
    I was too lazy to get my Kodak dig cam from my work van so i used my camera phone here...not the best for this obviously but you can read it. Sorry if that gives you a head ache.

    So I got it to work. but·I think I'm limited to the commands they mentioned in that small text file.

    I'm THINKING maybe these commands go to the ATMEL chip and maybe it then controls limited functions to the LCD module?

    If that is so, then maybe I can not use any commands other than these mentioned on the site???

    Command format :
    1. Display a string
    Serout TxD, 9600, [noparse][[/noparse]"0", cr]
    Serout TxD, 9600, [noparse][[/noparse]"string", cr]

    2. Clear whole display
    Serout TxD, 9600, [noparse][[/noparse]"1", cr]

    3. Point cursor to upperline
    Serout TxD, 9600, [noparse][[/noparse]"2", cr]

    4. Point cursor to upperline· (lowerline?)
    Serout TxD, 9600, [noparse][[/noparse]"3", cr]

    5. Shiftlcd right
    Serout TxD, 9600, [noparse][[/noparse]"4", cr]

    6. Shiftlcd left
    Serout TxD, 9600, [noparse][[/noparse]"5", cr]

    7. Locate Cursor
    Serout TxD, 9600, [noparse][[/noparse]"6", cr]
    Serout TxD, 9600, [noparse][[/noparse]"x", cr]·· x is the row selection
    Serout TxD, 9600, [noparse][[/noparse]"y", cr]·· y is the colum selection

    8. Cursor off & no blinking
    Serout TxD, 9600, [noparse][[/noparse]"7", cr]

    9. Cursor off & blinking
    Serout TxD, 9600, [noparse][[/noparse]"8", cr]

    10. Cursor on & not blinking
    Serout TxD, 9600, [noparse][[/noparse]"9", cr]

    11. Cursor off & blinking
    Serout TxD, 9600, [noparse][[/noparse]"10", cr]

    12. Cursor go home position (row = upperline, column = 1)
    Serout TxD, 9600, [noparse][[/noparse]"11", cr]

    13. Put raw command code to LCD module
    Serout TxD, 9600, [noparse][[/noparse]"12", cr]
    Serout TxD, 9600, [noparse][[/noparse]"code", cr]··· where code is a 8-bit value

    14. Put raw data to LCD module
    Serout TxD, 9600, [noparse][[/noparse]"13", cr]
    Serout TxD, 9600, [noparse][[/noparse]"data", cr]··· where data is a 8-bit value



    Where it says TxD i use my pin out, which is 0 right now.
    Where it says 9600 i had to use 84


    Well, at least I CAN get it to show text.
    Now I've had no experience at all with text displays, but looking at the stamp manual if i could use those commands in there·I could print a label which stays constant and then vary data shown after it, for example.
    If I am limited to these simple commands due to the Atmel then·I wont be able to do that :-(


    Of course, I'm just guessing now. Who knows?




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.paysonarizona.net/
  • steve_bsteve_b Posts: 1,563
    edited 2005-03-08 12:20
    Hey payson,
    if you were using Jon Williams template, then the T9600 would have worked, as it is the 'label' for 84 in his template.
    Just using the 9600 number doesn't represent a proper baudmode.

    They have to do a little bit of math with regards to the onboard oscillator to determine what value to use for serial'ing!
    This is why 84 works!· 84 is 9600 N,8 TRUE.

    If you were working with a PC, you'd need to invert the baud value and the baudmode would become 16468.
    None of the baudmode values actually equal the baudrate you're after, so you have to go in to the PBASIC help file and look it up under SERIN or SEROUT.

    But they do have a calculation as well, as some people encounter devices that are slightly off from a 'standard' baud rate.
    So, if you're using a BS2 (which I think you are) then: (1,000,000 / baudrate)-20.· So, 1,000,000/9600=104.17· now minus the 20 and you get 84!

    I've been bitten by this....had forgot the T9600 or N9600 based on Jon's template!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://ca.geocities.com/steve.brady@rogers.com/index.html
    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • paysonbadboypaysonbadboy Posts: 81
    edited 2005-03-09 00:28
    Yup. Reading that table in my basic Stamp Manual doing those calculations is what made me try the diff combinations.·I did think it was the exact baud speed until·I read more! I tried MANY of them (for the BS2) and the 84 was the last one·I thought of (9600 8 bit no parity-true) and it started working.

    Go figure. Now·I need to see how many commands·I can get to work. Does anyone know if it is actually that Atmel ship on my serial conversion board that is processing the commands and then tell the LCD what to do? Or does it just send·the data from the stamp·straight to the ·to the LCD module after it converts to parallel?


    That list·I posted last seems very limited compared the the commands I saw elsewhere!


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.paysonarizona.net/
  • RickBRickB Posts: 395
    edited 2005-03-09 04:17
    Commands 13 and 14 allow you to send raw lcd commands and data to the lcd. Look up the Hitachi 44780 data sheet to see what you are getting into.

    Rick
  • paysonbadboypaysonbadboy Posts: 81
    edited 2005-03-09 04:38
    OK. I wondered about those two codes. it said use them commands to send "8 bit words"

    I have no clue. Yet. More research. Of course ANY info you guys share is most appreciated as always!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.paysonarizona.net/
Sign In or Register to comment.