Serial Comm
electric550
Posts: 122
The return character in the below code from Web-PELabsFunBook is not working in HyperTerminal...Is there some setting I need to change?
'' File: EnterAndDisplayValues.spin
'' Messages to/from Propeller chip with Parallax Serial Terminal. Prompts you to enter a
'' value, and displays the value in decimal, binary, and hexadecimal formats.
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
OBJ
Debug: "FullDuplexSerialPlus"
PUB TwoWayCom | value
''Test Parallax Serial Terminal number entry and display.
Debug.start(31, 30, 0, 57600)
waitcnt(clkfreq*2 + cnt)
Debug.tx(16)
repeat
Debug.Str(String("Enter a decimal value: "))
value := Debug.getDec
Debug.Str(String(13, "You Entered", 13, "
"))
Debug.Str(String(13, "Decimal: "))
Debug.Dec(value)
Debug.Str(String(13, "Hexadecimal: "))
Debug.Hex(value, 8)
Debug.Str(String(13, "Binary: "))
Debug.Bin(value, 32)
repeat 2
Debug.Str(String(13))
And also I was wondering if there was a decent example of multiple cogs running assembly code sending values to central memory, and having one cog just reading those values and sending them out serially. I am planning on having a couple cogs running some IO, and they all need to communicate with one computer over serial. I figure running multiple serialcoms would step on each other, plus i think I saw this done somewhere on here I am just having trouble finding a good example. Anyways if someone could point me to a solution I would appreciate it thanks!
'' File: EnterAndDisplayValues.spin
'' Messages to/from Propeller chip with Parallax Serial Terminal. Prompts you to enter a
'' value, and displays the value in decimal, binary, and hexadecimal formats.
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
OBJ
Debug: "FullDuplexSerialPlus"
PUB TwoWayCom | value
''Test Parallax Serial Terminal number entry and display.
Debug.start(31, 30, 0, 57600)
waitcnt(clkfreq*2 + cnt)
Debug.tx(16)
repeat
Debug.Str(String("Enter a decimal value: "))
value := Debug.getDec
Debug.Str(String(13, "You Entered", 13, "
"))
Debug.Str(String(13, "Decimal: "))
Debug.Dec(value)
Debug.Str(String(13, "Hexadecimal: "))
Debug.Hex(value, 8)
Debug.Str(String(13, "Binary: "))
Debug.Bin(value, 32)
repeat 2
Debug.Str(String(13))
And also I was wondering if there was a decent example of multiple cogs running assembly code sending values to central memory, and having one cog just reading those values and sending them out serially. I am planning on having a couple cogs running some IO, and they all need to communicate with one computer over serial. I figure running multiple serialcoms would step on each other, plus i think I saw this done somewhere on here I am just having trouble finding a good example. Anyways if someone could point me to a solution I would appreciate it thanks!
Comments
Here is a sample output using the Parallax Serial Terminal
You Entered
Decimal: 8
Hexadecimal: 00000008
Binary: 00000000000000000000000000001000
Enter a decimal value:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
WWW.HAPB.NET
"Don't ask yourself what the world needs - ask yourself what makes you come alive, and then go do it." - H.T.Whitman
I have attached the program because it was faster then finding a link to it on the site.·
Dont forget that the serial port runs at a different voltage then the prop and can damage the prop if hooked directly to the computers comm port. You may already know that, but I got in a hurry awhile back and plain forgot that step. Also, when going through a level change device you might need to change the mode, such as invert TX or RX.
Example... When I was trying to use hyperterminal I had to change the mode to '2'.
Debug.start(31, 30, 2, 57600)
Just throwing out few more ideas that might help...
if you want to analyse every single byte received regardless of its value you can use bray's terminal for this
In brays terminal you can watch the incoming data as characters, hex, decimal or binary code
and you can even watch then all at the same time
you can log to a file
I have attached a zipfile with the software