Output serial commands
dr.video
Posts: 5
I am new to Propeller, have been BS2SX for many years, still trying to learn Spin. I have a project where need to output a couple char to control another device. (A,F,0,0,1) Been looking through many of the examples and reading everything I can find. But still having trouble wrapping my head around Spin code to program this, I have a Max202 chip between the propeller and the device I want to control.
Thanks from the Newbie- in Canada
Thanks from the Newbie- in Canada
Comments
http://obex.parallax.com/objects/30/
I think this makes it work like the stamp.
Otherwise the Propeller Tool comes with "FullDuplexSerial" that you can use...
You have to post some code... it doesn't matter how ugly or non-functional it is. This is not an absolute rule (there are no absolute rules here), but if you post some code everyone will jump in.
Rich
Another Doctor... this place is going to the nerds[noparse]:)[/noparse]
Newbie in Canada
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
The ser.start(31,30,0,9600)this defines Tx pin, RX pin mode and Baud?
repeat
c := ser.rx I am confused what this lines do
ser.tx(c)
Sorry guys for sucking up bandwidth, but I do really appreciate it
Dr.Video
ser = Obj name (OBJ ser : "FullDuplexSerial")
ser.rx = Call RX in OBJ - ser : "FullDuplexSerial" < Receive from Serial
c:= ser.rx - Fill variable c with RX bufer
ser.tx = Call TX in OBJ - ser : "FullDuplexSerial" < Transmit to Serial
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nothing is impossible, there are only different degrees of difficulty.
Sapieha
It's all in the file! Even if you can't read SPIN, you'll find a lot of useful comments there..
dr.video
Yes But You must flow This ser.start(-> 31,->30,0,9600)
ser.start(->YouPin,->YouPin,0,9600)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nothing is impossible, there are only different degrees of difficulty.
Sapieha
rx waits for a character to be received, then returns the character.
tx(c) waits for a free location in the transmit buffer, then stores the character passed as a parameter into the buffer. At some time in the future, the separate cog will get around to transmitting the character.
There are lots of other variations on these routines in FullDuplexSerial including a routine to receive subject to a timeout, one to flush the receive buffer, and several to do formatted transmission (like convert a number into decimal digits for transmission). Look at the source code comments.