Basic LED asm program
I started to play around with asm, again. The program below, which is run on the demo board, works, but it seems like led 23 is also turning on with led 24. It does not happen with led 17, and 16. I cannot figure out why led 23 is turning on.
The second question I have is, how could I call led1, and led2 from PUB Main? I guess what I am really after is, coding some "sub-routines" in asm, and calling them from the PUB Main part of the program.
Thanks
Ray
The second question I have is, how could I call led1, and led2 from PUB Main? I guess what I am really after is, coding some "sub-routines" in asm, and calling them from the PUB Main part of the program.
Thanks
Ray
'TestAsm2.spin
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
PUB Main
cognew(@Toggle,0)
DAT
ORG 0
Toggle
loop
call #led1
waitcnt Time,Delay1
call #led2
'waitcnt Time,Delay2
jmp loop
''''''''
led1
mov dira,Pin1
mov Time,cnt
add Time,#9
waitcnt Time,Delay1
xor outa,Pin1
led1_ret ret
''''''
led2
mov dira,Pin2
''mov Time,cnt
''add Time,#9
waitcnt Time,Delay2
xor outa,Pin2
led2_ret ret
'''''''''
Pin1 long |< 17
'Pin2 long |< 24
Pin2 long %00000000_10000000_00000000_00000000
Delay1 long 6_000_000
Delay2 long 12_000_000
Time res 1
Comments
The pins used for the LEDs are also used for the VGA output.
Any LED pins that are inputs will light if the next pin is connected to it via a VGA resistor.
Bean