PDA

View Full Version : Need Help with the FullDuplexSerial.class ...



jmlprop
02-03-2007, 12:01 AM
Hello,

I am new to the prop chip and object code. I am assuming that the FullDuplexSerial Code is a driver that sets upĚ communication for the prop. After the code is programmed in the chip can I just give a command to wait for serial data and if so could someone please give me an example for 9600 baud, 8-data bits and one stop bit, no parity.

Thank You.

glentech
02-03-2007, 12:43 AM
Not sure about what you are doing but if you use simple serial with the gps module lets say it would be something like this

con
(whatever speed you need)

obj:
serial:"simple serial"
text."tv_text" 'or vga or whatever

var
byte temp[120]

pub start|a
serial.start(pin,pin,4800)
repeat
text.out($1)
repeat a from 0 to 119 '120 read at a shot
temp[a]:=serial.rx
repeat a from 0 to 119
text.out(temp[a]
waitcnt(80_000_000+cnt)'wait one second

glentech
02-03-2007, 12:43 AM
make sure your indentation is correct as my reply did not include it

Mike Green
02-03-2007, 12:44 AM
First of all, have a look at the source code for FullDuplexSerial.spin which is included with the Propeller Tool. As is true with many of the I/O drivers written by a variety of people, there are comments, some detailed, that explain how the driver works and how to use it. Many of these drivers also come with a simple demo program. As an example for FullDuplexSerial:
[code]
obj
ser : "FullDuplexSerial" ' Full Duplex Serial Controller

con
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
serRecv = 0 ' Receive on I/O pin 0
serXmit = 1 ' Transmit on I/O pin 1

pri main | c
' Note that FullDuplexSerial does not handle parity and always
' uses 8 data bits and one stop bit. There are options for inverting
' either the transmit or receive lines or both and options for "open"
' signalling (open collector/drain) on transmit and for throwing away
' echoed received characters.
ser.start(serRecv,serXmit,%0000,9600) ' 9600 Baud
ser.str(string("This is a test string that will be transmitted.",13,10))
repeat
if (c := rxtime(500)) => 0 ' Wait up to 500ms for a character
case c of
"0".."9":
' do something with a digit
"A".."Z","a".."z":
' do something with a letter
13:
' ok, here's a return
8:
' backspace key

jmlprop
02-04-2007, 09:40 AM
Thanks guys, I will study this and ask further questions if needed.
Very Helpfull !
jmlprop