Shop OBEX P1 Docs P2 Docs Learn Events
Simplest code not working — Parallax Forums

Simplest code not working

bboy8012bboy8012 Posts: 153
edited 2008-07-27 03:14 in Propeller 1
I am trying to connect to the mini SSC II, I have this and for some reason it isnt working

CON
  _clkmode = xtal1 + pll16x      '80MHz operating frequency.
  _xinfreq = 5_000_000
  
VAR
byte position
OBJ
  comm  :       "Simple_Serial"
PUB main
  comm.init(0,-1,9600)
  repeat position from 0 to 254 step 1
    send2SSC(255, 0, position)
    waitcnt(1_000 + cnt) 
  
PRI send2SSC(sync, servo, pos)
  comm.tx(sync)
  comm.tx(servo)
  comm.tx(pos)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Hunger hurts, starvation works!

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-07-26 17:38
    You're trying to transmit, but you've configured the receive pin and not the transmit pin. Look at the source for Simple_Serial.

    -Phil

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Still some PropSTICK Kit bare PCBs left!
  • bboy8012bboy8012 Posts: 153
    edited 2008-07-26 18:32
    I have tried it both ways, and it is still not working. I know the ssc works cause I used it with the BS2. Is there anything wrong with my code. The ssc requires·a 3 byte message, and I thought this was the correct way to do it send2ssc method.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Hunger hurts, starvation works!
  • TimmooreTimmoore Posts: 1,031
    edited 2008-07-26 19:11
    You might want to try inverting the serial port - use a -ve baud rate

    comm.init(-1,0,-9600)

    The SSC manual says the data should be inverted
  • bboy8012bboy8012 Posts: 153
    edited 2008-07-26 19:37
    Thanks Tim, I knew it was something stupid, and I scan the manual multiple times and never even saw that.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Hunger hurts, starvation works!
  • Cluso99Cluso99 Posts: 18,069
    edited 2008-07-27 03:14
    There are two thing I see that could cause problems.

    You are trying to send characters in the serial but you need to send this information as

    · comm.dec(...)

    I presume the simple_serial has the same options as FullDuplexSerial object. There is also

    · comm.hex(...,8) 'where 8 is the number of hex digits you want to display

    It is possible that the spin code is slower that the 1000 you have added to cnt - try 1_000_000 just to be sure.
Sign In or Register to comment.