Sunday, 25 April 2010

Programming

setint %01000000,%01000000 ; Interrupt when pin6 goes high

main1: ; First part of program
let w0 = 1
readadc 1,b1
readadc 2,b2

select case b1
case 0 to 80
high 3
case 80 to 155
low 3
endselect

select case b2
case 0 to 100
high 1
case 80 to 155
low 1
endselect

goto main1

main2: ; Second part of program
setint %01000000,%01000000
let w0 = 0
high 2
low 1
goto main2

interrupt: ; interrupt routine

if w0 = 1 then
goto main2
endif
if w0 = 0 then
goto main1
end if





I am still in the development stage of the program. I have run into problems with the interrupt. I was able to set it so that when pin6 (switch) goes high program switches from main1 to main2 and vise versa. but as I simulate it, it goes from main1 to main2 when pin6 goes high but then gets stuck in the main2 loop and doesnt run the interrupt when I set pin6 high again.

No comments:

Post a Comment