Shop OBEX P1 Docs P2 Docs Learn Events
how display on LCD using ADC0831 — Parallax Forums

how display on LCD using ADC0831

newbie2008newbie2008 Posts: 2
edited 2008-01-10 09:06 in BASIC Stamp
I was wondering if anyone have interfaced ADC0831 with LCD screen (2 x 16 backlight)
i succefully displayed the voltage sampled on debug screen but i am not being able to code to display on LCD
if anyone have any sample code please let me know
thx

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-10 01:20
    If this is one of the LCD displays sold by Parallax, check the webstore page for sample programs. There's nothing special about using an ADC0831 with an LCD. If it's a serial LCD, you'd still use the SEROUT statement with it, very much like the DEBUG statement. If it's a parallel LCD, you will need to convert the number received from the ADC0831 to characters to display.

    You'll have to say more about what you have and what you want to do specifically.
  • newbie2008newbie2008 Posts: 2
    edited 2008-01-10 03:33
    thx mike
    here is the description
    i am reading voltage (0-5v) out of a current sensor and feeding it to BS2 through ADC 0831. now i have to display that voltage on a LCD (2x16 serial LCD from parallax)
    i am totally new to basic stamp programming so dont really know how to start.
    here is the code i used to display the voltage in debug command.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    '
    [noparse][[/noparse] Declarations ]
    adcBits VAR Byte
    v VAR Byte
    r VAR Byte
    v2 VAR Byte
    v3 VAR Byte
    '
    [noparse][[/noparse] Initialization ]
    CS PIN 0
    CLK PIN 1
    DataOutput PIN 2
    DEBUG CLS 'Start display.
    '
    [noparse][[/noparse] Main Routine ]
    DO
    GOSUB ADC_Data
    GOSUB Calc_Volts
    GOSUB Display
    LOOP
    '
    [noparse][[/noparse] Subroutines ]
    ADC_Data:
    HIGH CS
    LOW CS
    LOW CLK
    PULSOUT CLK, 210
    SHIFTIN DataOutput,CLK,MSBPOST,[noparse][[/noparse]adcBits\8]
    RETURN
    Calc_Volts:
    v = 5 * adcBits / 255
    r = 5 * adcBits // 255
    v2 = 100 * R / 255
    v3 = 100 * r // 255
    v3 = 10 * v3 / 255
    IF (v3 >= 5) THEN v2 = v2 + 1
    IF (v2 >= 100) THEN
    v = v + 1
    v2 = 0
    ENDIF
    RETURN
    Display:
    DEBUG HOME
    DEBUG "8-bit binary value: ", BIN8 adcBits
    DEBUG CR, CR, "DVM Reading: ", DEC3 v, " Volts"
    DEBUG CR, CR, "DVM Reading: "
    DEBUG DEC1 v, ".", DEC2 v2, " Volts"
    RETURN


    now if you can suggest me how can i display on LCD that would be of great help
    thx
  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-10 06:38
    The documentation on the webstore product page is very complete and there are examples you can download. I suggest you read the documentation and look at the examples. If you have any questions after that, then post them and reference the documentation (like "the documentation says xxxx and I don't understand whether they mean yyyy or zzzz" or "the documentation says xxxx and the DEBUG statement does yyyy and I'm not sure how to do that").
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2008-01-10 09:06
    Try the LCDs provided software to first verify that it is functional and connected properly. From that point it should be obvious how you can merge the LCDs supporting software with your existing program.

    It is always best to first verify that you can make the added hardware work alone before you try to cut and paste software to fit your needs. In this case, you will just replace the Debug output with the appropriate interface to LCD. You may have to add another serial port, consider the right baud rate, and you may want to keep Debug working until you have both I/Os doing the same thing.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PLEASE CONSIDER the following:

    Do you want a quickly operational black box solution or the knowledge included therein?······
    ···················· Tropically,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan

    Post Edited (Kramer) : 1/10/2008 9:13:33 AM GMT
Sign In or Register to comment.