Shop OBEX P1 Docs P2 Docs Learn Events
BS2p serial out — Parallax Forums

BS2p serial out

darnitdarnit Posts: 25
edited 2006-04-14 15:14 in BASIC Stamp
I am trying to interface to a serial CrystalFonts 635 LCD to a BS2p.· I believe I have the CRC probem handled, but the thing i am really having trouble with is the·\ character.· For example if i try to send out this

SEROUT SO, Baud,[noparse][[/noparse]31,7,\000\001hello,$85,$05]

the stamp editor complains about the \ character.·

31 = send data to lcd (row,col)
7 = data length
\000 = row address
\001 = col address
hello = text to display
$85,$05 = CRC

Does anyone have any ideas on how to send out this command ?

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-04-13 14:17
    It sounds like your device is expecting the data in ASCII form, based on the hello you have there.· If that is the case then that would need to be put into quotes.· Are you sure of your baud rate parameter as well?


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • darnitdarnit Posts: 25
    edited 2006-04-13 14:32
    I am able to send commands that have no data such as ping and clear display, so i know the baud rate is correct. when i look at the serial line with an oscope the data from the stamp does not resemble the data from their pc test program (wintest). the command (31), data length (7) and the check sum bytes match up but i cant get the actual data to match either with quotes or not. I am resisting getting out my logic analyzer and relearning how to use the serial probe....
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-04-13 15:01
    Without knowing exactly what you device is expecting I can only guess...Perhaps if you had a link to the datasheet or manual so I could loook at the structure of commands that would help.· Until then the fact that you're trying to send a backslash and a 3-digit number makes me think it should be an ASCII string.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Tom WalkerTom Walker Posts: 509
    edited 2006-04-13 15:17
    ...unless you are coming from a "higher-level" background and expect that to send an ASCII 0 (nul) you must send it as an "escape" character such as \000...

    Try changing your SEROUT to something like [noparse][[/noparse]31,7,0,1,"hello",$85,$05]...or better yet, assigning constants (command) and variables (data_length, xpos, ypos, chksum1, chksum2) and see if that works.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
  • darnitdarnit Posts: 25
    edited 2006-04-13 15:27
    This is the link to the data sheet.· I will try the suggestions tonight. isnt the \ a C language escape character?· Thanks to all.



    http://www.crystalfontz.com/products/635/635_data_sheet.html
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-04-13 16:31
    Well, the datsheets on this page seem to indicate that this is a USB Module.· Does it have a driver which converts (addresses) that as a Virtual COM Port?· All of the examples are in C, which is suspect is what is causing your problems in translation.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • darnitdarnit Posts: 25
    edited 2006-04-13 16:41
    The version I have of this module is an rs232 serial configuration. I am communicating to it through the rs232 chip on the professional development board. As you can see, one must read between the lines of that particular manual. I wish their docs were as squared away as Parallax.
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2006-04-13 16:53
    The Stamp won't complain if you put the string in quotes:

    SEROUT SO, Baud,[noparse][[/noparse]31,7,"\000\001hello",$85,$05]

    When it is not in quotes, the Stamp thinks the "\" is a dangling modifier.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-04-13 17:22
    Tracy,

    ·· I'm not sure if the codes are formatted properly.· I mentioned the quotes in my first reply and he didn't mention that working, so I am trying to determine if it needs a backslash or if that is something from the C formatting.· Any ideas?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • SSteveSSteve Posts: 808
    edited 2006-04-13 17:43
    He only needs the quotes around hello. The datasheet shows that the two values before the text are the x & y positions which are binary values. He was using \000\001 because those are the escape sequences he's used to from C. Tom's suggestion (SEROUT SO, Baud,[noparse][[/noparse]31,7,0,1,"hello",$85,$05]) will work assuming the original poster's CRC is correct.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    OS-X: because making Unix user-friendly was easier than debugging Windows
  • darnitdarnit Posts: 25
    edited 2006-04-13 18:45
    If anyone wouldl ike to go to the below link and download the 635_wintest.exe program...it can be run without an lcd attached to the pc. open up the packet debugger and send one of the display settings , you will see how the data is formatted before it is set to the display. at least i think that is what it is showing.


    http://www.crystalfontz.com/software/index.html
  • darnitdarnit Posts: 25
    edited 2006-04-14 12:57
    First of all let me thank everyone for their suggestions....it really helped alot. I spent a great deal of time working on this last night and determined that the source of most of my problems was an intermitant signal ground in the ribbon cable going from the lcd to the stamp. Unexpected because it was a brand new cable. Once that was solved, I was able to try the suggestions you all graciously provided. As it turns out Toms solution was perfect. Now all I have to do is integrate it with the CRC routine.

    Thanks again everyone.

    This is a great forum!!!
  • Tom WalkerTom Walker Posts: 509
    edited 2006-04-14 15:14
    I'm glad it worked out for you.

    Have fun!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
Sign In or Register to comment.