AssemblyToggle.spin
Unsoundcode
Posts: 1,532
Hi , I have an adaptation of AssemblyToggle.spin where instead of xor'ing outa with "Pin" I am xor'ing outa with a·constant called "sData" trying to·toggle output 17.
My adaptation works the same as AssemblyToggle.spin with the exception that there is a long delay before it takes off , maybe 30 seconds.
Can someone explain why I have the delay at start up and what I have wrong or need to do to make the toggle start immediately.
I'm trying to figure out how to mask the outa register in different ways
Jeff T.
My adaptation works the same as AssemblyToggle.spin with the exception that there is a long delay before it takes off , maybe 30 seconds.
Can someone explain why I have the delay at start up and what I have wrong or need to do to make the toggle start immediately.
I'm trying to figure out how to mask the outa register in different ways
CON _CLKMODE = XTAL1 + PLL16X _XINFREQ = 5_000_000 Pub main cognew (@myasm,0) dat org 0 myasm mov dira, direction mov time,cnt add time,#9 mov outa,sData :loop waitcnt time,delay xor outa,sdata jmp #:loop direction long |<17 sData long $AAAAAAAA delay long 6_000_000 time res 1 fit 496
Jeff T.
Comments
Try a larger increment to "time". I'd try at least 15. There's 1 or 2 needed for the "mov time,cnt" to finish, then 4 for the ADD and 4 for the 2nd MOV and probably 5 for the WAITCNT to start waiting.
One "trick" is to add CNT as the last step before the WAITCNT like
Post Edited (Mike Green) : 9/10/2009 7:22:46 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The original AssemblyToggle.spin from the Propeller Manual had " add Time, #9 'Set minimum delay here " which didn't make sense to me at the time but is a little clearer now.
In my adaptation I tried #15 and it worked fine.
A good lesson for the day.
Jeff T.