''*************** ''* PASD Test * ''*************** '' CON 'Use the following 2 lines if running on a Parallax PropDemo board _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 'Use the following 2 lines if running on a Hydra board '_clkmode = xtal1 + pll8x '_xinfreq = 10_000_000 VAR long Cog, TestVar OBJ dbg : "PASDebug" '<---- Add for Debugger PUB main Cog := cognew(@entry, @TestVar) + 1 dbg.start(31,30,@entry) '<---- Add for Debugger PUB stop if Cog cogstop(Cog~ - 1) DAT org 0 entry ' --------- Debugger Kernel add this at Entry (Addr 0) --------- long $34FC1202,$6CE81201,$83C120B,$8BC0E0A,$E87C0E03,$8BC0E0A long $EC7C0E05,$A0BC1207,$5C7C0003,$5C7C0003,$7FFC,$7FF8 ' -------------------------------------------------------------- ' ' Test code with modify, MainRAM access, jumps, subroutine and waitcnt. ' :init mov dira,LEDS ' Configure LEDs as outputs (1) andn outa,LEDS ' Set LEDs to the 'Off' state (0) mov BlinkCounter,#0 ' Clear blink counter :led_state_1 or outa,LED_0 ' Turn on LED 0 (Hydra) or outa,LED_16 ' Turn on LED 16 (PropDemo) andn outa,LED_17 ' Turn off LED 17 (PropDemo) call #wait ' Delay :led_state_2 andn outa,LED_0 ' Turn off LED 0 (Hydra) andn outa,LED_16 ' Turn off LED 16 (PropDemo) or outa,LED_17 ' Turn on LED 17 (PropDemo) call #wait add BlinkCounter,#1 cmp BlinkCounter,#5 wz if_z jmp #:init jmp #:led_state_1 wait mov WaitCounter,cnt add WaitCounter,BlinkFreq waitcnt WaitCounter,BlinkFreq wait_ret ret ' ' VARIABLES ' BlinkCounter long 0 LEDS long $00FF_0001 ' Bits 16-23 are PropDemo board leds. Bit 0 is Hydra LED. LED_0 long $0000_0001 ' Hydra LED. LED_16 long $0001_0000 ' PropDemo board LED. LED_17 long $0002_0000 ' PropDemo board LED. BlinkFreq long 40_000_000 WaitCounter res 1 fit