Shop OBEX P1 Docs P2 Docs Learn Events
PST on other pins? — Parallax Forums

PST on other pins?

jimgoldenjimgolden Posts: 4
edited 2012-05-11 05:55 in Propeller 1
Hello, I was wondering if the pst could be used on other pins? I went thru the library and found
PUB StartRxTx(rxpin, txpin, mode, baudrate) : okay
{{Start serial communication with designated pins, mode, and baud.
  Parameters:
    rxpin    - input pin; receives signals from external device's TX pin.
    txpin    - output pin; sends signals to  external device's RX pin.
    mode     - signaling mode (4-bit pattern).
               bit 0 - inverts rx.
               bit 1 - inverts tx.
               bit 2 - open drain/source tx.
               bit 3 - ignore tx echo on rx.
    baudrate - bits per second.
  Returns    : True (non-zero) if cog started, or False (0) if no cog is available.}}
  stop
  longfill(@rx_head, 0, 4)
  longmove(@rx_pin, @rxpin, 3)
  bit_ticks := clkfreq / baudrate
  buffer_ptr := @rx_buffer
  okay := cog := cognew(@entry, @rx_head) + 1

So I tried it setting the pins to 12 and 13 and mode 0 and 9600 baud. It did not work, so I went back to just the psd.Start(9600) and hooked up to the tx line on the propeller to the Rx line on my chipkit32 uno and it worked(I did have both of them connected to a commor ground) I was just sending an "a" waiting 3 seconds, then an "s" and it worked great. While nothing was being transmitted I received a "-1" which is great because there will never be any negitive numbers sent. So that gives me a free "i am idle" character, Next I will try going from the chipkit to the propeller. Then on to sending strings and stuff to see what I can do!

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-05-08 05:58
    PST can be used on any pins. There's no reason why it shouldn't work with pins 12 and 13. It's impossible to tell why it didn't work for you without more information about how you connected it and how you called it. StartRxTx is how the object is actually initialized. Start(9600) just supplies pins 31 and 30 along with mode 0.
  • jimgoldenjimgolden Posts: 4
    edited 2012-05-11 04:15
    Well, what I am trying to do is transmit a number to the chipkit32 uno and also monitor what I am sending to it also at the same time on the serial terminal window. Will I need to start a new cog to run the other pst? Here is what I am trying to use.
    CON
       
      _clkmode = xtal1 + pll16x                             ' Crystal and PLL settings.
      _xinfreq = 5_000_000                                  ' 5 MHz crystal (5 MHz x 16 = 80 MHz).
    OBJ
      pst    : "Parallax Serial Terminal"                   ' Serial communication object
      pst1   : "Parallax Serial Terminal"
    PUB go | value                                  
       pst1.StartRxTx(1,2,0,9600)                                                             ' Start the Parallax Serial Terminal cog
       pst.Start(9600)  
    ''---------------- Replace the code below with your test code ----------------
      
      repeat                                                                        ' Main loop
        pst.Char(3)
        pst1.Char(3)
        pst.Str(String("I have sent the number Three"))                                                            
         
         pst.Char(4)
        pst1.Char(4)
        pst.Str(String("I have sent the number Four"))
      
         waitcnt(clkfreq * 2 + cnt)                   ' Announce output
        {
    
  • Mike GreenMike Green Posts: 23,101
    edited 2012-05-11 05:55
    Parallax Serial Terminal is a modified version of the FullDuplexSerial I/O driver and, as such, already uses a separate cog for the actual buffered transmission / reception of data. You can declare multiple instances of Parallax Serial Terminal and they can and will co-exist peacefully. What you've shown in the previous post may not work as you expect. .Char sends the value of its parameter as a single byte, not as a readable number. As a result, the "3" or "4" will be interpreted by the other end as a control character, not text.
    Try .Dec instead.
Sign In or Register to comment.