Shop OBEX P1 Docs P2 Docs Learn Events
Serial from dev board to PC through USB (newbie) — Parallax Forums

Serial from dev board to PC through USB (newbie)

amandoamando Posts: 1
edited 2009-02-14 23:12 in Propeller 1
Can I use something like Simple_Serial to talk from a Propeller development board to a PC through the USB port. I am talking about the USB to serial converter that is connected to pins 30 and· 31.· I am getting inconsistant results. I can sometime echo a single character OK, but if I try to print Hello! World! on the PC I get garbage. It seems like a baud rate mis-match. Which baud rate should I use?

Many thanks
Jeff Hanson

{{
······· Try to use the simple serial object
······· We are talking between a PC and the dev board.
······· We are talking though the USB connector,
······· so the serial comes out on pins 30 and 31 (Rx and Tx).
}}
CON
· _clkmode = xtal1 + pll16x
· _xinfreq = 5_000_000
VAR
· long bite
·
OBJ
· SERIAL :····· "Simple_Serial"
· LED :········ "Display_Byte"
PUB main
· dira[noparse][[/noparse]30]~~
· dira[noparse][[/noparse]31]~
·
· LED.init
· LED.display($00_00_00_AA)
·
· SERIAL.init(31, 30, 9600)
· LED.display($00_00_00_11)
· SERIAL.str(sal)
· LED.display($00_00_00_33)
· bite := SERIAL.rx
· SERIAL.str(sal)
·
· repeat
··· LED.display($00_00_00_77)
··· bite := SERIAL.rx
··· LED.display(bite)
··· SERIAL.tx(bite)
DAT
sal···· byte "Hello! World!", 0
freaked.gif
·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-02-14 23:12
    The Baud is set on both ends of the "conversation". In the example you posted, The Baud on the Propeller end is set to 9600. Part of your problem may be your call to SERIAL.str( ). If you read the source code in the object, you'll see that this call expects the address of a zero-terminated string. You're providing the value of the first byte. You want SERIAL.str(@sal) instead.
Sign In or Register to comment.