Shop OBEX P1 Docs P2 Docs Learn Events
Writing variables to parallel LCD. — Parallax Forums

Writing variables to parallel LCD.

Palli SteinaPalli Steina Posts: 6
edited 2009-01-12 22:46 in BASIC Stamp
Hi all, first post to this forum.

Im using BS2 on Professional Development board from Parallax. I got a 2x16 parallel LCD screen from Parallax. I have run one of the demos that came with Stamp Works, and it displays just fine, so the connections and the display is working.

Now... the problem.

Im making a simple remote control for laser modulation. By pressing buttons A and B I change the frequency of the modulation by 1 hz at a time. That part of the program works great. But what I cant do, is write the status of the HZ counter to the LCD.

In every example I have found, the use of EEPROM and predefined messages is required, but I dont want that, I just want to write 1 Hz, 2 Hz, 3 Hz etc. whenever the button is pressed.

Current pins:
0 = Laser(Led)
1 = PB1
2 = PB2

5 = E
6 = RW
7 = RS
8 = DB0/DB4
9 = DB1/DB5
10 = DB2/DB6
11 = DB3/DB7

I would appriciate if you could point me in the right direction, either by a very shrot minimal initial startup code for the LCD and how to write a variable to it or just explain to me how it works! [noparse]:)[/noparse]

Either way, I will appriciate the help.

Thanks in advance,
Regards,
Palli Steina

Comments

  • MoskogMoskog Posts: 554
    edited 2009-01-12 16:36
    Something like this....?


    ' {$STAMP BS2}
    ' {$PBASIC 2.5}


    LCD PIN 1 ' serial output to LCD on BS2 Pin 1
    LcdBaud CON 32 ' Baudrate 19.2KHz with BS2
    LcdLine1 CON $94 ' move to line 1, column on LCD
    Hertz VAR Word ' Declare variable Hertz as a Word


    ...program code.....


    SEROUT LCD, LcdBaud,[noparse][[/noparse]LcdLine1, "Frequency: ",Hertz," Hz] 'Write to LCD line 2 from top

    ...rest of programcode....
  • Palli SteinaPalli Steina Posts: 6
    edited 2009-01-12 16:51
    Thanks for the answear Moskog.

    But this is a parrallel LCD display, does that peice of code work for it?

    Regards,
    Palli Steina
  • MoskogMoskog Posts: 554
    edited 2009-01-12 17:02
    Oh, sorry, I did't see that. That code was for the serial LCD with backpack from Parallax.
    I have no experience with the pure parallel LCD yet and I guess before I reach to figure out a good explanation someone else will give you good help.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-01-12 19:27
    Hello,

    To be honest I cannot believe we haven’t put something up. So what I have done is take the Stamp Works Experiment #11 code and remove the cursor animation and replace it with a simple counter loop that counts from 0 through 65535. This value is then displayed on line 2 of the Parallel LCD. There are two versions of the code and below is an explanation. I hope this helps and it will be listed on our Parallel LCD product page as well.

    Parallel LCD Vars Leave.bs2 – This program demonstrates how to display up to a 16-bit numeric variable on a parallel LCD using the StampWorks Parallel LCD code as framework. To use this code, connect your Parallel LCD as per the StampWorks Kit Experiment #11 and then download and run this code. This version leaves leading zeros in values printed. This can often help preserve display formatting when items are printed to the right of the variable.

    Parallel LCD Vars Strip.bs2 – This program demonstrates how to display up to a 16-bit numeric variable on a parallel LCD using the StampWorks Parallel LCD code as framework. To use this code, connect your Parallel LCD as per the StampWorks Kit Experiment #11 and then download and run this code. This version strips leading zeros in values printed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • Palli SteinaPalli Steina Posts: 6
    edited 2009-01-12 19:39
    Hi, Chris and thank you for your answear. This is what I call support!

    This is exactly what I was hoping for and I really appriciate it. Was looking like I was going to have to take the dev board on site. [noparse]:)[/noparse]

    Regards,
    Palli Steina

    Post Edited (Palli Steina) : 1/12/2009 8:06:25 PM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-01-12 20:09
    Palli,

    Glad to help. The fact that this comes up so often really means we needed the example code anyway. I have been working with LCD displays since the Hitachi HD44780 chipset so I used Parallel displays long before the serial backpacks became popular. The problem is all my existing code is written in 65xx, 68xx or Z80 assembly. So today was good day to just write some example BASIC Stamp code. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • sylvie369sylvie369 Posts: 1,622
    edited 2009-01-12 22:13
    Excellent. Yes, this question does come up quite often, and it's important to have Parallax-supplied demo code.

    Have you considered making this a "sticky"? It'll be a lot easier to refer others to it if it's up there at the top.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-01-12 22:46
    Too many sticky threads can become a problem as well. Instead we’ll add the code to our website and we can always point there if need be.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
Sign In or Register to comment.