Shop OBEX P1 Docs P2 Docs Learn Events
Serial LCD — Parallax Forums

Serial LCD

John.GrayJohn.Gray Posts: 22
edited 2006-06-21 12:45 in General Discussion
· I have been reading over the code example for SX/B and a serial LCD.· I want to understand the examples, but am lost in it's wake.

I basically want to print a sentence on the LCD so I had good luck using the BS2 and want to use that example for the SX

SEROUT 15, 84, [noparse][[/noparse]22, 12] ' Initialize LCD
PAUSE 500
SEROUT 15, 84, [noparse][[/noparse]"Write Something Here", 13, ' Text message, carriage return
"Second Line"] ' more text on line 2.

What I tried to do was:

SEROUT ra.0, T9600, "Something Here"

What showed up on the screen was "S"

· What am I missing?·

·

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-05-11 17:50
    What you're missing is that SEROUT in SX/B only transmits one byte at a time -- you have to create a subroutine to send strings. You can store strings inline or in DATA statments and retrieve bytes with READ -- see the READ instruction in the help file for suggestions on reading/sending strings.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • John.GrayJohn.Gray Posts: 22
    edited 2006-05-11 19:45
    Jon,

    I'm still going back over the Read and Data trying to understand the commands, I never did grasp setting up tables and look up, look down. But to make myself feel like I did something today I used this to get some letters up on an LCD:

    DEVICE SX28, OSCHS3, TURBO, STACKX, OPTIONX
    IRC_CAL IRC_SLOW
    FREQ 50_000_000
    PROGRAM start_point

    start_point:

    Tx_pin var ra.0

    Clear CON $0C ' clear LCD (need 5 ms delay)
    Line1 CON $80 ' move to line 1, column 0
    Line2 CON $94 ' move to line 2, column 0

    HIGH ra.0
    pause 5


    serout tx_pin, T9400, $0C
    serout tx_pin, T9400, "H"
    serout tx_pin, T9400, "E"
    serout tx_pin, T9400, "L"
    serout tx_pin, T9400, "L"
    serout tx_pin, T9400, "O"

    The question I have is the last three letters keep flashing at a high rate, I know this isn't normal
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-05-11 20:10
    Is this for the Parallax Serial LCD?· If yes, the attached program will get you going.

    One of the things you will want to be careful about is using "code heavy" keywords multiple times -- SEROUT is one of those.· If you look at the asm source for your program you'll see it takes a lot of code to do SEROUT (by necessity), and doing it five times is just using more space than you need.· If you put SEROUT into a subroutine it only gets compiled once and you can add flexibility to it.

    http://www.parallax.com/dl/src/prod/serial_lcd_demo.sxb

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax

    Post Edited (Jon Williams (Parallax)) : 5/11/2006 8:13:45 PM GMT
  • John.GrayJohn.Gray Posts: 22
    edited 2006-05-11 21:24
    Jon,

    I'm still working on the SX/B SUB command and the use of _PARAM, _PARAM1 and _PARAMCMT. I've plugged the BS2 into the PDB and I'm going back through the books and will start doing some of the examples using DATA and LOOKUP. I have been trying to use the code examples found under the LCD section, when I try and run the code, I get errors all over the place,

    LCD_CCHAR CC0
    LCD_CCHAR CC1
    LCD_CCHAR CC2
    LCD_CCHAR Smiley
    line 107, 108, 109 Error 8, Pass 1 Invalid Parameter "CC0"
    line 107, 108, 109 Error 10, Pass 1 Invalid number of Parameters

    READ Msg2 + idx1, newChar
    line 124, Error 8, Pass 1 Invalid Parameter "Msg2"

    Like I said earlier, this is something I have no idea how to do, but with the amount of info out there, I will, and as always, when I get stuck, lost or a well placed kick in the rear, I will turn to here
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-05-11 21:29
    Are you running the latest version of SX/B? You should be using SX/B version 1.42.01 -- you can get it in a sticky post at the top of this forum.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • John.GrayJohn.Gray Posts: 22
    edited 2006-05-11 21:38
    I went ahead and loaded 1.42.01 again, I still get the same error codes
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-05-11 21:39
    Interesting -- I opened that program and it compiles just fine. Click on Help > About and click on the serial numbers, they will rotate through and you should see 1.42.01 for SX/B -- double-check this.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • John.GrayJohn.Gray Posts: 22
    edited 2006-05-11 21:42
    It says 1.42 not 1.42.01, I just downloaded the new version and restarted the system...what did I miss?
  • BeanBean Posts: 8,129
    edited 2006-05-11 21:45
    You need to put the files in C:\Program File\Parallax Inc\SX-Key 3.1\Compilers\SXB

    Version 1.42.01 WILL fix the errors.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com


    COMING SOON "SD DATA LOGGER" www.sddatalogger.com

    "I reject your reality, and substitute my own." Mythbusters
    ·
  • John.GrayJohn.Gray Posts: 22
    edited 2006-05-11 21:53
    Thanks, working the issue right now
  • John.GrayJohn.Gray Posts: 22
    edited 2006-05-11 21:58
    Okay, the program runs...now I'm going to put this away for the night and go home. Tomorrow I'll play some more, and ask more questions in the process
  • kroki78kroki78 Posts: 13
    edited 2006-06-17 16:22
    Hi! i'm and SX newbie. I have many experience with BS and a little with PIC. Now i need to control a 24x8 char serial LCD.
    I use SX/B cause i'm used to Basic, and i have many problems with ASMsmile.gif
    It recieves 9600Baud data. I tryed the classical SEROUT ra.1, T9600, "@".
    I also tried N9600 too, but it doesn't work.
    I figured, that maybe the oscillator isn't correct, so i tried the internal 4Mhz, 20Mhz and 50Mhz oscillators and even a 3.6864Mhz Quartz, and no result, only sometimes some random char.

    The funny thing is that on the PIC with some basic compiler it works with a simple serout, like the one above.

    Could anyone help me solve this problem?

    p.s.: is it possible to SEROUT data in SX/B in 7bit format?
  • SawmillerSawmiller Posts: 276
    edited 2006-06-17 19:46
    try using a external oscillator... the internal ones dont seem to work for serial communications as good for me

    not sure about 7 bit format...

    but i have had good results with using jons txbyte and txstring routines

    dan
  • kroki78kroki78 Posts: 13
    edited 2006-06-17 20:33
    Thanx, but as i wrote it above, i tried 20, 50 and 3.6864Mhz external oscillators too.

    I will see about that string combination, thanx for the tip.
  • BeanBean Posts: 8,129
    edited 2006-06-18 14:31
    Kroki78,
    Please post the COMPLETE program you are using.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com

    "I reject your reality, and substitute my own." Mythbusters
    ·
  • kroki78kroki78 Posts: 13
    edited 2006-06-19 07:51
    I think i will post the code today if i get home.
    btw. i managed to display some correct text on the display yesterday, after i browsed many complete codes.
    Can somebody tell me why i have to use 9400Baud at 50Mhz, 9560Baud at 20Mhz for 9600Baud display? Because these were the values that worked somehow.
    And with 3.6864Mhz and a 22.1884Mhz Baud rate resonators the 9600 Baud rate value still doesn't work with SEROUT!!! Why?
  • pjvpjv Posts: 1,903
    edited 2006-06-20 04:04
    Hi Kroki;

    As Bean said, as soon as you post your code we might have a chance at telling you! Without your help we are simply being asked to waste our time!

    Cheers,

    Peter (pjv)
  • kroki78kroki78 Posts: 13
    edited 2006-06-20 13:58
    Hi!

    I just managed to post a little test prog for the 9600Bps serial display.

    The working values for the baud rates for SEROUT are "T9400" for 50Mhz and "T9560" for 20Mhz.

    Why is this? Could be some compilation "error"?

    The next question is that i have a GPS module where 4800Bps data is the output. How can i work with the string (about 200 char/second) that is the output of the module? I need to store somewhere these, and cut/paste some data from it to a display or some serial line to other uC.

    The GPS is working according to Garmin standard as i know it.
  • BeanBean Posts: 8,129
    edited 2006-06-20 20:54
    Kroki78,
    Are you using SX/B version 1.42.01 ?
    Are you using the Parallax 20MHz and 50MHz resonators ?
    I'm stumped for the moment ???

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com

    "I reject your reality, and substitute my own." Mythbusters
    ·
  • kroki78kroki78 Posts: 13
    edited 2006-06-20 21:13
    i use SX/B 1.42.
    i bought the resonators at the local parallax dealer, so it's probably itsmile.gif
    for the moment, i try to use a 4x20 paralell LCD(easy on the code), but i still need some idea how to deal with the GPS data.
    I worked with it with Basic Stamp 2P and it was quite a complex code i wrote, but i need more computing power (Mhz) for my project.

    is there any way to capture more than 200byte serial string? (at 4800Baud, once in 1sec, so i have about 300-400ms for computing) I need to filter out some data from that string.

    maybe an EEPROM? I think it's too slow. probably an external SRAM?

    Kroki

    p.s.: i like ur prase from the Mythbusters Bean. i used to say that too
  • kroki78kroki78 Posts: 13
    edited 2006-06-20 21:22
    i just downloaded the 1.42.01 and tomorrow i will try the serout again with it.
  • pjvpjv Posts: 1,903
    edited 2006-06-21 02:43
    Hi Kroki;

    You ask for help, and the responses are for you to post your code so we that CAN help you. Folks will be getting tired of requests for help when you don't want to do your part.

    There are many ways to solve your technical problem(s), but only one way to solve the other problem!

    Cheers,

    Peter (pjv)
  • kroki78kroki78 Posts: 13
    edited 2006-06-21 12:45
    Thanx pjv, i am thankful for u guys trying to help me. And i will do my best to do my part too, sorry.
    The reason why i didn't post any codes with the GPS idea is, that i don1t have any yet, cause i need some idea to start with.

    With the serial display i figured out how to work. and i already posted some code.
Sign In or Register to comment.