LCD terminal AppMod
I bout this LCD because of the buttons thought I could use them for later uses. I am finding that it is harder to program and do what I want with this LCD than a serial LCD. I am studying the demo code for it trying to figure out how to get it to work and been scan the forums to see if there is someone with my issue. I am wanting to use the LCD for the debug terminal with the thermometer chip. If some one could post a url of some sample code or some code of how to get the stamp to send the debug info to this LCD be greatly welcomed.
Thank you
Lutamos
Thank you
Lutamos
Comments
http://forums.parallax.com/showthread.php?p=771280
I had to include my username in the search to find it, so I can see why you couldn't find it.
The key parts of the code related to the buttons are these:
(in the declarations[noparse]:)[/noparse]
This declares a nibble-sized (that is, 4 bit) variable "buttons", and then names each of those 4 bits. The variables btnA, btnB, btnC and btnD are just the 4 bits that make up the variable "buttons".
The comments for that part of the code make it pretty clear what's happening, I think.
Since the same I/O lines are used to read the buttons and to send data to the LCD, those lines must be made into inputs before the buttons can be read, and then made back into outputs afterwards so that information can be sent to the LCD. Those are the first and last lines of the subroutine.
Next you want to read the state of those four lines into the "buttons" variable. Simply reading it in once would give you the dreaded "bounce" problem, so instead there's a loop to ensure that a button is pressed for real. The 4 bits are all set to "1" at the start of that loop, and then inside of the loop, each bit is ANDed with the current state of its corresponding LcdBusIn line (that is, with its I/O line). If a button is not pressed, its line will be "0", and when you AND 1 with 0, you get 0. If a button is pressed, its line will be "1", and when you AND that with 1, you get 1. As a result, the 4 bits of the "buttons" variable will correspond to the 4 bits of the LcdBusIn at the end of that 50 ms loop.
Earlier code uses the "buttons" variable to choose what to display on the LCD:
This is a bit more cryptic (though efficient) than it might need to be for a demo program. When idx = 0, it looks at the lowest bit of the buttons variable (that is, btnA), and if that bit is set (=1), it displays the character defined by "A" + 0, which is simply "A". If that bit is 0, then it displays a dash.
Then it goes on to idx = 1. It asks "Is the second lowest bit of the buttons variable set?". That is, buttons.LOWBIT(1), which is a reference to btnB (see how confusing it is?). If so, then it displays the character defined by "A" + 1, which is "B". What's going on there is that "A" gives you ascii 65, and you can simply treat "A" as though it were another way of saying 65, adding and subtracting numbers to it to your heart's content. "A" + 1 is simply 66, which is ascii "B", so char = 66, and when it's displayed, you get a "B". Clever, but cryptic for us newbies.
Notice though that if he hadn't done it that way, there'd have to be a mess of IF-THENs with all of the different letters to display. It'd be easier to read, but much less efficient code.
Post Edited (sylvie369) : 1/10/2009 4:50:32 PM GMT
That code unfortunately does not display the value of numeric variables. 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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
Thank, you
Lutamos
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering