Propeller Serial Communication question.
JMLStamp2p
Posts: 259
Good evening,
I have been using a BS2 for serial communication and it is working well but I would like to use a Propeller for the speed and parallel processing. I know nothing about assembly language, do I have to use some assembly for serial communication with a propeller ?
Could someone give me a simple code sample to recieve data into a propeller using 9600 baud, 8-data bits, no-parity and 1 stop bit. I have a propeller board that I can test the program out on.
Thanks,
JMLStamp2p
I have been using a BS2 for serial communication and it is working well but I would like to use a Propeller for the speed and parallel processing. I know nothing about assembly language, do I have to use some assembly for serial communication with a propeller ?
Could someone give me a simple code sample to recieve data into a propeller using 9600 baud, 8-data bits, no-parity and 1 stop bit. I have a propeller board that I can test the program out on.
Thanks,
JMLStamp2p
Comments
SimpleSerial
FullDuplexSerial
They do all the heavy lifting for you.· All you have to do is call a function to send or receive a byte on the serial connection.· SimpleSerial is a half-duplex object if your requirements are minimal.· FullDuplexSerial launches another cog and maintains a receive buffer.· It can communicate over 100 Kbaud.
You only need to know SPIN to use either.
Hope this is helpful.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The more I know, the more I know I don't know.· Is this what they call Wisdom?
Post Edited (Ken Peterson) : 10/26/2007 1:09:21 AM GMT
Could you give me a simple code example that would set up a cog to run in a loop, look for serial data and turn on a specific led on the propeller board after I have loaded Full Duplex Serial.
JMLStamp2p
Andy
JMLStamp2p
I have installed your code but I get a "Circular Referance" Error when I try and load it into Ram. I am probally installing the code in the wrong place. Could you please tell me where I need to install the code, I have it installed at the top of the FullDuplexSerial
code right under the varibles declarations.
Thanks,
JMLStamp2p
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
I have put the code example in a seperate file and have downloaded it into the propeller with no faults. As far as downloading several files or Objects into the propeller such as FullDuplexSerial and the code sample above. Does pressing F10 download both files into the prop at once if I have both of them open in the editor? I have a Propeller Demo board with outputs 0 - 7 on the Header and would like to transmit a byte of "INVERTED DATA" out of pin 7 once every second and also blink an LED "PIN(16)" on the demo board folowing the serial transmission. Could someone adjust the following code sample to accomplish this, and what does the code fragment
| b accomplish following the MAIN statement ?
and
b := ser.tx
ser.start(31,30,1,9600)
From what I understand 30, 31 in the above statment is the recieve & transmit pins to be used, am I correct ?
If I want to use Pin "7" to transmit data out of the propeller do I need to change these accordingly or is this just the way the traces are set up on the Demo board?
thank's so much for the help.
........................................................................................................................................................................................
{{ Serial Test }}
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
LED_PIN = 16
OBJ ser : "FullDuplexSerial"
PUB Main | b
ser.start(31,30,1,9600) 'start the serial driver, Mode "1" for Inverted Data ?
dira[noparse][[/noparse]LED_PIN] := 1 'LED Pin = output
repeat
b := ser.tx
outa[noparse][[/noparse]LED_PIN] := b & 1 'set LED from received Bit0
....................................................................................................................................................................................
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
Does anyone know if I should change pin 30 to pin "7" since I am using a propeller demo board and have a scope attached to the header ?
.......................................................................................................................................................................................
{{ Serial Test }}
CON
_CLKMODE = RCSLOW
LED = 16
OBJ ser : "FullDuplexSerial"
PUB Main | b
dira[noparse][[/noparse]16]~~
dira[noparse][[/noparse]17]~~
ser.start(31,30,1,9600) 'start the serial driver, Mode "1" for Inverted Data ?
dira[noparse][[/noparse]LED] := 1 'Make pin 16 an Output output
repeat 3
b:= ser.tx(01)
!outa[noparse][[/noparse]16]
waitcnt(10000 + cnt)
b:= ser.tx(07)
!outa[noparse][[/noparse]16]
waitcnt(10000 + cnt)
.........................................
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
Im getting somewhere, but slow :>)
JMLStamp2p
Gosh , this is 20kHz! A SPIN line would execute in >20 ms
and it's just a "Blink" :>)
Thanks for your help,
JMLStamp2p
{{ Serial Test }}
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
LED = 16
OBJ ser : "FullDuplexSerial"
PUB Main | b
dira[noparse][[/noparse]16]~~
dira[noparse][[/noparse]7]~~
ser.start(31,7,1,9600)
waitcnt(10000000 + cnt)
repeat
!outa[noparse][[/noparse]16]
waitcnt(100000000 + cnt)
b:= ser.tx(01)
waitcnt(100000000 + cnt)
!outa[noparse][[/noparse]16]
b:= ser.tx(82)