Stumped: No luck watching a cogs output pin.
Paul
Posts: 263
I'm trying to·watch the state of a pin that a cog is outputting with a 60 hz signal.· I can't figure out how to get the signal to show up on pin A6. Pin A5 works fine. Knowing that all cogs "share" I/O pins I thought this would be fairly easy. What piece of the puzzle am I missing?
Thanks,
--Paul
EDIT: Ok this is 30 Hz ...but still the same problem
Post Edited (Paul) : 3/8/2007 7:43:41 PM GMT
Thanks,
--Paul
{{TESTS reading outa[noparse][[/noparse]21] }} con _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 VAR ' Global Variables long stack[noparse][[/noparse]20] byte pin PUB Start dira[noparse][[/noparse]6]~~ cognew (square( 21 ),@stack) repeat outa[noparse][[/noparse]6] := outa[noparse][[/noparse]21] '<<< Doesn't work! PUB square(pn) dira[noparse][[/noparse]pn]~~ dira[noparse][[/noparse]5]~~ repeat !outa[noparse][[/noparse]pn] waitcnt(clkfreq/60 + cnt) outa[noparse][[/noparse]5] := outa[noparse][[/noparse]pn] '<<< works 'inside' cog.
EDIT: Ok this is 30 Hz ...but still the same problem
Post Edited (Paul) : 3/8/2007 7:43:41 PM GMT
Comments
I am not completely sure, but could you try
outa[noparse][[/noparse]6] := ina[noparse][[/noparse]21] ?
I assume, it does not work, because you try to read the output register of a different cog.
Christof
yep, that worked! I'm not sure why either. I must have read that part of the manual backwards. I thought the output register outa, held the status. I guess thats only internal to the cog.
It's interesting that: outa5 and outa[noparse][[/noparse]6] are now 180 out of phase.
Back to the books for me!
Thanks very much.
--Paul
Post Edited (Paul) : 3/8/2007 8:50:22 PM GMT