Having difficulties starting cogs
kutalinelucas
Posts: 80
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?
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)
Comments
Really? From the docs (under DIRA): "Each cog maintains its own DIRA register that gives it the ability to set any I/O pin's direction."
Well, there's your problem!
I'm not here to defend Parallax, but as someone who writes a lot of documentation I think it is fair to say that it is impossible, especially with a controller as sophisticated as the Propeller, to explain every possible interaction in every section of the manual -- it would end up as thick as pieces of recent federal legislation and be about as useful.
It was only an observation and I was just surprised that I didn't find much mention that each cog was required to define it's access to each pin (when I was stuck and scrolling through google). I've done some things with 8051's, PICs, FPGA's and everything is relativly standard, to be honest the re-defining of pin directions is the biggest practical difference (regarding programming) I've noticed...it's sooo good.
But anyway, no biggy, and long live the prop