Shop OBEX P1 Docs P2 Docs Learn Events
SX and Parallax USB2SER — Parallax Forums

SX and Parallax USB2SER

John KauffmanJohn Kauffman Posts: 653
edited 2006-10-11 23:18 in General Discussion
I’ve put together various posts and downloads to get info on the USB2SER·working with my Hyperterminal and SX Tech Tool.
I’m close, but hypertext is showing me garbage instead of a message.
·
Note that I·for programming and debug I·use the Parallax USB to Serial convertor which then goes to a serial cable to my SX for programming and debugging (COM4). That stays plugged in while running the program.· For the USB2SER I use a second USB port and cable to COM5.·
·
Here is what I did:
·
Plug the USB2Ser via cable into PC
Driver was found and message that the hardware is ready to use
Check COM assignment = COM5
Change com5 latency from 16 mSec to 1mSec

SX breadboard connectsion from USB2SER to SX
RES to 20k resistor to RB.0 necessary or optional?
TX to 20k resistor to RB.2·· resistors necessary?···········
RX to 20k resistor to RB.1
Vss direct to Vss
Set up hyperterminal
New connection, give name
Connect Using COM5
Set Post settings to defaults
Bits per second = 2400
Data bits = 8
Parity = none
Stop bits = 1
Flow content = Hardware
session is automatically started.
·
>>>>>>>>>>>>>·
·
Test #1 Program in SX/B
DEVICE········· SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ··········· 4_000_000
PROGRAM Main
Main:
· · SEROUT RB.2, N2400, "hello"
·
Load and run the program, view Hyperterminal
Observed: continious flow onto hyperterminal screen of an ASCII character (like an F – probably a double lined-border character)
·
>>>>>>>>>>>>>·
·
Test #2 Program in SX/B
DEVICE········· SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ··········· 4_000_000
PROGRAM Main
Main:
· DO
· SEROUT RB.2, N2400, "hello"
LOOP
·Load and run the program, view Hyperterminal
Observed: one random character appear after each press od SX Tech Tool reset button

Comments

  • BeanBean Posts: 8,129
    edited 2006-10-11 13:43
    John,
    The internal 4MHz clock is not accurate enough for serial communications. It's something like +/- 8%.
    Change OSC4MHZ to OSCXT1 and use the SX-Key or a 4MHz resonator for a clock source.

    Bean.

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

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com

    Don't mistake experience for intelligence. And vis-vera.
    ·
  • John KauffmanJohn Kauffman Posts: 653
    edited 2006-10-11 14:27
    Removed power from SX Tech Toool
    inserted 4MHZ resonator into xT header.
    Changed code to (below)
    Powered up and Ctrl+R, assembled OK & chip reported running
    Removed power, removed SXkey
    Powered up
    Same problem of continous flow of chars to hyperterminal screen (but different character flowing to hyperterminal)
    Flow stops while Reset held down

    DEVICE SX28, OSCXT2, TURBO, STACKX, OPTIONX
    FREQ 4_000_000
    PROGRAM Main
    Main:
    do
    SEROUT RB.2, N2400, "hello"
    loop
  • John KauffmanJohn Kauffman Posts: 653
    edited 2006-10-11 14:28
    I tried both OSCXT1 and OSCXT2, based on Guenther's FAQ.
    No difference in result
  • Mike CookMike Cook Posts: 829
    edited 2006-10-11 14:30
    John,

    Try:

    SEROUT RB.2, T2400, "hello"

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike
  • John KauffmanJohn Kauffman Posts: 653
    edited 2006-10-11 14:36
    Bean & Mike:

    Getting closer:
    Now get a string of "h" characters rather then randoms.
    If I put the SEROUT inside a do loop I get one "h"

    Now, I just need the Ccockney greeting: 'ello
  • Mike CookMike Cook Posts: 829
    edited 2006-10-11 14:39
    John,

    Sorry...........brain off line! You will need to write a routine to send strings out. The SEROUT will only send one character at a time. Take a look at the attached file. You'll need to modify as necessary for the PIN's, DEVICE, and FREQ.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike
  • John KauffmanJohn Kauffman Posts: 653
    edited 2006-10-11 14:46
    Great. Thanks, guys.
    I tested with a cheater program (five commands of SerOUT, each with one letter).
  • JonnyMacJonnyMac Posts: 9,442
    edited 2006-10-11 19:02
    With SX/B 1.5 you can use a Word variable and the READINC instruction to simplify sending strings. Like this:

    ' Use: TX_STR [noparse][[/noparse] string | label ]
    ' -- "string" is an embedded literal string
    ' -- "label" is DATA statement label for stored z-String
    
    TX_STR:
      tmpW1 = __PARAM1, __PARAM2            ' save address
      DO
        READINC tmpW1, tmpB1
        IF tmpB1 = 0 THEN EXIT                     ' if 0, string complete
        TX_OUT tmpB1
      LOOP
      RETURN
    
    
  • BeanBean Posts: 8,129
    edited 2006-10-11 19:40
    Welcome back Jon,
    Nice simple routine.

    P.S. Your first line could be "tmpw1 = __WPARAM12".

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

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com

    Don't mistake experience for intelligence. And vis-vera.
    ·
  • Mike CookMike Cook Posts: 829
    edited 2006-10-11 22:48
    JonnyMac,

    Aren't you supposed to be out Haunting? Just kidding, Nice to see you are back!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike
  • JonnyMacJonnyMac Posts: 9,442
    edited 2006-10-11 23:18
    The haunters are getting a LOT of my time these days, but as I'm working with Ken on a project that involves the SX and SX/B I decided to come back and hang with my SX homies.

    Thanks for the wecome notes, and for the simplification (that one is almost a "D'oh!" moment, isn't it?).
Sign In or Register to comment.