assembly call
in Propeller 1
New @ assembly... I want to have cogs putting out square waves at two freqs, and do something else in spin... also would like to have
an assembly routine I could call to just put out a short pulse (<1Us)
see code... not working...
Thanks...
an assembly routine I could call to just put out a short pulse (<1Us)
see code... not working...
Thanks...
Comments
Andy
pub pulse_out(pin, tix) | mask mask := |<pin ctra := (%00100 << 26) | pin ' configure for pulse frqa := 1 dira[pin] := 1 phsa := -tix ' start pulse waitpeq(mask, mask, 0) ' wait for high wanipne(mask, mask, 0) ' wait for low ctra := 0 ' kill counter
Warning... if the pulse is VERY short, the waitpeq may get missed -- you'll need to test. You can also port this code to PASM; there is nearly a 1-for-1 instruction match.good job guys...
Bill
The second parameter of cognew() is the hub address that is your mailbox. Since this address is passed to the cog, you can use it as a base address for several values. In this demo, there is only one (ticks). Note that when the pulse is done the cog tells the Spin program it's finished by clearing the ticks pulse timing.