Hi,
I am using the LM3S9B92 evalboard. I have connected the LCD to this board and its working fine, now I want to change the text on the LCD (like changing the menu) using buttons. I am using the port A of the board to connect the board in the 8-bit mode. I would like to know how to use buttons for the aforesaid purpose from scratch. Where should I connect the buttons? The change on the LCD will occur by connecting it to the RS, RW or E of the LCD.
Any help will be greatly appreciated.
Thanks.
Kind Regards,
Ravi Singh
Ravi Singh97557The change on the LCD will occur by connecting it to the RS, RW or E of the LCD.
While those signals are necessary - they are not sufficient by themselves to cause change. Likely you have chosen text Lcd (small graphic may also use such signals) and - as you know either 4 or 8 bit data bus - working in conjunction with RS, RW & E - is required to read or write the Lcd.
Don't have that evalboard - did review schematic - I would have chosen Port E as 8 bit data bus, and PF: (0, 1, 4) as the control signals as they are all available on the bottom right pin array and/or header/connector. Further - both 3V3 and Gnd are available from that same location - simplifies your cabling/testing. Experience teaches that it is always preferable to install headers and employ mating ID ribbon cable sockets - as opposed to individual wires. (greatly aids board re-use) Note that some modern text Lcds may directly accept 3V3 as power source - older ones will generally work with 3V3 applied to VDD - however often you must then supply a slight negative voltage to the contrast Vo pin. (don't go more negative than -4V, -2V usually works)
Your eval board schematic doesn't show - but PB4 is charted as connecting to the board User switch/button. To create a user friendly menu you'll likely need these buttons: Up, Down, Enter and possibly Left & Right. Best to choose all of these from the same port - to simplify your software button decoding. A switch statement works nicely to decode.
Menu code can be as involved as you like - we employ a variable to track just "how deep" we are w/in the menu - and then the single "switch" button decode vectors to the appropriate GPIO action (as/if required) and to the message appropriate for that menu depth & selection. Always wise to have a non-tech user "try" and comment upon your menu design - beware of drinking and over-enjoying your own Kool Aid... Bon chance...
Thank you cb1_mobile, The change on the LCD will occur by connecting it to the RS, RW or E of the LCD, was actually a question (forgot the q-mark). I have female headers on all the ports of my board, cant take chances with the board and I did try with the port E prior using the port A, but for some reason it didn't work so I moved on. Also I have used port F only for the signals. The USR PB does not fulfill my requirements, hence want to use external switches.
Ravi Singh97557did try with the port E prior using the port A, but for some reason it didn't work
Curious that - we always try to "escape" our custom or Eval Board from single header as/if possible. Also - as future consideration by you/others - Port_A usually is very rich in communication pins (Uart, SPI, I2C) while Port_E is less option oriented. (in most cases)
Dawned on me after my post - should you be GPIO limited - or seek more efficient use of pins - you can use the Lcd DataBus lines for keypad/switch read as well. Two general methods we've seen/used: 1) employ resistors so that keypad can drive these pins - yet MCU's drive will dominate/control should both events overlap. and 2) employ 1 "freed" GPIO as a keypad "enable" - which will only allow keypad to drive LcdBus during "Non E-Strobe" of Lcd. (only "critical period" of Lcd transaction is during E strobe event) Another benefit - Lcd DataBus "pulls up" each of these data lines.
Regarding your Switch Array - use switch/GPIO up to around 8 or fewer switches. (At 9 switches - mux'ed switch wiring reduces 9 GPIO count to 6.) While not fulfilling your requirements - I'd still "start" with pre-wired/tested USR PB so that you can use/model/better master TI code.
Ravi Singh97557I have connected the LCD to this board and its working fine
Ravi Singh97557The change on the LCD will occur by connecting it to the RS, RW or E of the LCD, was actually a question
That is a very puzzling question!
If you have the LCD "working fine" then you must, surely, already have the code that controls the LCD - otherwise, how would you know that it's "working fine"??!
I know that the LCD is working fine, I also have the code, I just wanted to know how and where to connect external buttons so that when I press that button, some change takes place on the LCD. But looks like you are more interested in finding grammatical errors than helping me with what i really need.
Ravi Singh97557 I know that the LCD is working fine, I also have the code, I just wanted to know how and where to connect external buttons so that when I press that button, some change takes place on the LCD. But looks like you are more interested in finding grammatical errors than helping me with what i really need.
Well, I was asking myself the same question as Andy, if you know how to connect the LCD and drive it within the software, then what can be so difficult to connect(and control) a few buttons?
But let me guess, it's the software part you're looking after(menu structure), right?
And for your last sentence, as far as I know, Andy is not the kind of guy to waste his time on finding grammatical errors, but if you respond like that, don’t expect much help from him in the future.
Ravi Singh97557I just wanted to know how and where to connect external buttons
You can use any avilable port pins that you like! Look at the schematics of your board to see what pins are available.
Also look at the schematics of your Stellaris board (or any other board) to see examples of how to connect switches.
Ravi Singh97557when I press that button, some change takes place on the LCD
You need to write code that reads the state(s) of the switch(es), and acts upon what it reads - in your case, that will include updating the LCD.
Stellarisware includes examples that read switches, and use this to control program operation.
Ravi Singh97557helping me with what i really need.
It's up to you to make clear what it is that you really need.
Thanks Andy