Shop OBEX P1 Docs P2 Docs Learn Events
Need Help with the FullDuplexSerial.class ... — Parallax Forums

Need Help with the FullDuplexSerial.class ...

jmlpropjmlprop Posts: 9
edited 2007-02-04 02:40 in Propeller 1
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.

Comments

  • glentechglentech Posts: 35
    edited 2007-02-02 17:43
    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[noparse][[/noparse]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[noparse][[/noparse]a]:=serial.rx
    repeat a from 0 to 119
    text.out(temp[noparse][[/noparse]a]
    waitcnt(80_000_000+cnt)'wait one second
  • glentechglentech Posts: 35
    edited 2007-02-02 17:43
    make sure your indentation is correct as my reply did not include it
  • Mike GreenMike Green Posts: 23,101
    edited 2007-02-02 17:44
    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:
    [noparse][[/noparse]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
  • jmlpropjmlprop Posts: 9
    edited 2007-02-04 02:40
    Thanks guys, I will study this and ask further questions if needed.
    Very Helpfull !
    jmlprop
Sign In or Register to comment.