Code:
'' *** COMPILED WITH PropBasic VERSION 00.00.79 Feb 3, 2010 ***
CON 'DEVICE P8X32A, XTAL1, PLL16X
_ClkMode = XTAL1 + PLL16X
_XInFreq = 5000000 'FREQ 80_000_000
' LEDS PIN 23..16 LOW 'LEDS PIN 23..16 LOW
' Delay SUB 1 'Delay SUB 1
PUB __Program 'PROGRAM Start LMM
__OFFSET := @__Init
CogInit(0, @_LMM_Entry, @__DATASTART)
DAT
org 0
__Init
mov dira,__InitDirA
mov outa,__InitOutA
jmp #_LMM_JUMP
long @Start - @__Init
Start 'Start:
mov __temp1,#255 ' LEDS = 255
shl __temp1,#16
and __temp1,LEDS
andn outa,LEDS
or outa,__temp1
mov __param1,#100 ' Delay 100
jmp #_LMM_CALL
long @Delay_ret - @__Init
long @Delay - @__Init
mov __temp1,#0 ' LEDS = 0
shl __temp1,#16
and __temp1,LEDS
andn outa,LEDS
or outa,__temp1
mov __param1,#100 ' Delay 100
jmp #_LMM_CALL
long @Delay_ret - @__Init
long @Delay - @__Init
jmp #_LMM_JUMP ' GOTO Start
long @Start - @__Init
mov __temp1,#0 'END
waitpne __temp1,__temp1
Delay 'SUB Delay
mov __temp1,cnt ' PAUSE __param1
adds __temp1,_1mSec
mov __temp2,__param1
mins __temp2,#1 WC
__L0001
IF_NC waitcnt __temp1,_1mSec
IF_NC djnz __temp2,#_LMM_JUMP
long @__L0001 - @__Init
rdlong __PC,__PC 'ENDSUB
Delay_ret
long 0-0
DAT
'-------------------------------------------------------------------------------------------
'LMM Execution code
' -------------------------------------------------------------------------------------------
ORG 0
_LMM_Entry
mov __PC,__OFFSET
_LMM_LOOP
rdlong __INSTR1,__PC
add __PC,#4
__INSTR1
nop ' Placeholder for LMM instruction
rdlong __INSTR2,__PC
add __PC,#4
__INSTR2
nop ' Placeholder for LMM instruction
rdlong __INSTR3,__PC
add __PC,#4
__INSTR3
nop ' Placeholder for LMM instruction
rdlong __INSTR4,__PC
add __PC,#4
__INSTR4
nop ' Placeholder for LMM instruction
jmp #_LMM_LOOP
_LMM_JUMP
rdlong __PC,__PC
add __PC,__OFFSET
jmp #_LMM_LOOP
_LMM_CALL
rdlong __temp1,__PC
add __temp1,__OFFSET
add __PC,#8
wrlong __PC,__temp1
sub __PC,#4
rdlong __PC,__PC
add __PC,__OFFSET
jmp #_LMM_LOOP
' Variables for LMM execution code
__OFFSET LONG 0-0' Set by spin
__PC LONG 0 ' Program counter
'**********************************************************************
__InitDirA LONG %00000000_11111111_00000000_00000000
__InitOutA LONG %00000000_00000000_00000000_00000000
_1mSec LONG 80000
LEDS LONG 255 << 16
_FREQ LONG 80000000
__remainder
__temp1 RES 1
__temp2 RES 1
__temp3 RES 1
__temp4 RES 1
__temp5 RES 1
__param1 RES 1
__param2 RES 1
__param3 RES 1
__param4 RES 1
__paramcnt RES 1
FIT 492
CON
LSBFIRST = 0
MSBFIRST = 1
MSBPRE = 0
LSBPRE = 1
MSBPOST = 2
LSBPOST = 3
DAT
__DATASTART
Bookmarks