Shop OBEX P1 Docs P2 Docs Learn Events
Having difficulties starting cogs — Parallax Forums

Having difficulties starting cogs

kutalinelucaskutalinelucas Posts: 80
edited 2011-08-17 07:44 in Propeller 1
I'm having some difficulties starting a new cog and was wondering if somebody could help me out...

I'm writing a program which reads in 2 variables, the first to identify a specific motor, the second for the required rotation of that motor. All i'm looking to start a new cog and pass these two variables, do the move (while the first two cogs are waiting for futher instructions) and then exit the cog when completed.

So far the data is read by 2 cogs and succesfully passed to the object posted below, but for some reason I can't get a new cog to run...could somebody please help?
CON
        delay = 3_000_000
VAR
        long rotation
        long motmov
        Long motstack[12]
OBJ
 
PUB start(reconstructed_data, Motor_ident)
cognew(turn_motor,@motstack)
motmov := reconstructed_data
if motmov < 30
  !OUTA[9]
 
if motmov > 30
  !OUTA[8]
 
PUB turn_motor
 
Repeat
  !OUTA[10]
    waitcnt(Delay + cnt)


...i'd be happy to post the rest of the code if it'll be helpful

Martyn.

Comments

  • kutalinelucaskutalinelucas Posts: 80
    edited 2011-08-17 07:44
    dagnamit! Didn't realise each cog has it's own set of DIRA registers so my other cogs work because the prop sets the pins as inputs...must be honest...that isn't too well documented, I just happened across a 'similar thread link'

    Sorted for now...thanks
Sign In or Register to comment.