Shop OBEX P1 Docs P2 Docs Learn Events
newbie - SX and OLED display — Parallax Forums

newbie - SX and OLED display

AttemptAttempt Posts: 3
edited 2009-01-22 20:32 in General Discussion
I have been having a tough time getting the SX to work with the OLED display. So far nothing has worked.
Has anyone had success with this combination? I see a lot of comments with the prop chip but nothing with the sx.
Code sample would help. I can only imagine that is where my issue is.

TIA

Comments

  • RickBRickB Posts: 395
    edited 2009-01-21 04:35
    Unless you post your schematics and code, all WE can do is imagine.

    Rick
  • AttemptAttempt Posts: 3
    edited 2009-01-21 16:17
    The code is fairly simple:

    I do not have a schematic diagram
    but I attached the reset line to RA1, RA2 to the RX line and RA# to the TX line.


    Regards,
    Paul

    '
    ' Device Settings
    '
    DEVICE········· SX28, OSCXT2, TURBO, STACKX, OPTIONX
    FREQ··········· 4_000_000
    ID··"SERIN"


    ' values
    RstLine······· ·VAR···· RA.1·················· ' I/O pin for RCTIME
    Sout·········· ·VAR···· RA.2··················· ' output to SEETRON 2x16
    Sin··VAR·RA.3
    LED··var·rc.7
    Baud··CON·"OT9600"

    tRead··var·byte
    ' Program
    Program start
    Start:
    ·high ·LED
    ·' reset the device
    ·high ·RstLine
    · ·pause·500
    ·low·RstLine
    ·pause·500
    ·high·RstLine
    ·pause·2000
    ·low·LED
    ·' send a u
    ·SEROUT Sout, baud, $55·············· ·' send the character
    ·high ·led
    ·pause ·500
    ·low·led
    ·SERIN Sin, baud, tRead
    ·
  • PJMontyPJMonty Posts: 983
    edited 2009-01-21 20:31
    Paul,

    I'm having a problem with my car. It's not running right. Can you figure out why?

    Let me guess, you can't really help me because I haven't given you enough information.

    That's the amount of info you're giving people here.

    If you want help, then you need to post ALL the information. Schematics, part numbers, code, etc. For example, you say you can't get the OLED to work. What OLED? It's not like there is just one OLED in the world. Is it serial? Parallel? Who made it? The lack of a schematic makes it hard as well. Is the circuit your own design? A Parallax board? Is there a level inverter on the serial output? Are you using a resonator? An oscillator? The built in oscillator?

    Don't have a schematic? Then make one. There are about a zillion drawing programs on the market, as well as free circuit design programs like Eagle. You can download it from here:

    www.cadsoft.de/

    You can also just draw something on a piece of paper and scan it into the computer.

    Basically, if you want help, you need to step up and provide enough information for people to help you without playing 20 questions.

    Thanks,
    PeterM
  • ZootZoot Posts: 2,227
    edited 2009-01-22 18:30
    If you are really using open true mode on the serial line (Baud CON "OT9600"), then you need a 4.7k or so pull-up resistor on the serial line, or it won't ever go "high" when released by the SX.

    Also, put an "Sout = 1" at the very start of the init sequence -- this will put a high on the Sout the first time it is made an output, so that OLED doesn't see a false start bit.

    I would also explicitly define your pins as inputs/outputs and just use pin = 1 or pin = 0 to set states, rather than HIGH and LOW, e.g.

    RstLine         VAR     RA.1 OUTPUT                   ' I/O pin for RCTIME
    Sout            VAR     RA.2  OUTPUT                  ' output to SEETRON 2x16 --- this sounds like an LCD?
    Sin  VAR RA.3  INPUT
    LED  var rc.7 OUTPUT
    
    



    Is this the *whole* program? It doesn't end, nor does it loop back to the beginning. As it stands, I would think it would crash after the SERIN. Lastly, I would take out the pause 500 after the serout -- you are waiting 500ms for a response -- I would think serin will hang as the response will surely have come before the 500ms is up. Remember that SERIN WILL WAIT for a start bit, then read 8 bits at the given baud rate....

    Of course, w/o a schematic, spec sheet on the OLED, etc, it's hard to know if you have already done this, if your baud is correct, if your commands are correct, if indeed the device is open true serial comm., etc.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • Shawn LoweShawn Lowe Posts: 635
    edited 2009-01-22 18:38
    Zoot-
    Just to verify for myself, will the internal pullups work or do you have to have an external pullup.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Shawn Lowe


    When all else fails.....procrastinate!
  • ZootZoot Posts: 2,227
    edited 2009-01-22 18:45
    Internal pullups may theoretically work, but they are very weak for this purpose and noise can be an issue. 4.7k-10k is common.

    Also, the larger external resistor gives the juice a place to go if for some reason both a slave and the master drive the line in opposite directions (which shouldn't happen, but we all make mistakes -- generally with open true the slave or the master drives the line low, and "releases" the high level (by making the serial pin an input).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • Shawn LoweShawn Lowe Posts: 635
    edited 2009-01-22 20:32
    Thank you for the clarification.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Shawn Lowe


    When all else fails.....procrastinate!
Sign In or Register to comment.