Shop OBEX P1 Docs P2 Docs Learn Events
Trying to send serial to speed controller - Page 2 — Parallax Forums

Trying to send serial to speed controller

2»

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-12-16 21:54
    kwinn wrote: »
    The 0x0d is treated as a hexadecimal number and converted to a carriage return.

    Not on the Prop. It needs to be $0d.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-12-16 21:55
    I just noticed you're using the same pin for tx as rx. I don't think FDS can do that, but I'm not sure.
  • stuartXstuartX Posts: 88
    edited 2013-12-16 21:56
    But if I'm just sending commands....should I only use the tx pin?
  • stuartXstuartX Posts: 88
    edited 2013-12-16 22:00
    picture is attached. Cannot clearly see crystal but its T5.00
    1024 x 768 - 93K
  • stuartXstuartX Posts: 88
    edited 2013-12-16 22:06
    Guys!!!
    That worked.
    I apologized. I just replaced it with your clock statement.

    Thank you!! Thank you!! Thank you!!
  • kwinnkwinn Posts: 8,697
    edited 2013-12-16 22:12
    Duane Degn wrote: »
    Not on the Prop. It needs to be $0d.

    Doh, you're absolutely right. Too many compilers/assemblers under the bridge.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-12-16 22:12
    The following code should turn on motor #1 at half speed. Pause three seconds and stop the motor. It should then turn the motor on at full speed for another three seconds.
    OBJ
      pst : "FullDuplexSerial.spin"
    CON
      _clkmode = xta11 + p1116x
      _xinfreq = 5_000_000
      TxPin = 0
      motor = 1
      speed = 1000
    PUB Main
      pst.Start(TxPin + 1, TxPin, 8, 115_200)
      waitcnt(clkfreq + cnt)
      repeat
        pst.Str(String("!G 1 500", 13))
        waitcnt(clkfreq * 3 + cnt)
        pst.Str(String("!G 1 0", 13))
        waitcnt(clkfreq * 3 + cnt)
        pst.Str(string("!G "))
        pst.Dec(motor)
        pst.tx(" ")                  
        pst.Dec(speed)
        pst.tx(13)
        waitcnt(clkfreq * 3 + cnt)
        pst.Str(string("!G "))
        pst.Dec(motor)
        pst.tx(" ")                  
        pst.Dec(0)
        pst.tx(13)
    
    

    I use "8" to turn off the rx echo instead of the binary number since the forum software messes up the binary unless you use the basic editor.

    Edit: I just saw you got it working good. It's times like these I regret having never learning to properly curse.
  • kwinnkwinn Posts: 8,697
    edited 2013-12-16 22:13
    stuartX wrote: »
    Guys!!!
    That worked.
    I apologized. I just replaced it with your clock statement.

    Thank you!! Thank you!! Thank you!!

    Great. Good luck with your project.
  • stuartXstuartX Posts: 88
    edited 2013-12-16 22:14
    I'll try this out now.

    But it was the clock statement and the ,13 works.

    Let me give this a try.
  • stuartXstuartX Posts: 88
    edited 2013-12-16 22:21
    Cool!!!
    Yes!
    that worked like a charm
    I have to go back and review your changes so that I understand all of them.
    But thanks for your help guys...much appreciated.

    THANK YOU!! THANK YOU!!!!
Sign In or Register to comment.