what am I doing wrong???
propshaft
Posts: 3
Greetings. I am a new to the Propeller, but not new to microcontrollers and assembler.
I have looked at a lot of code examples and done a lot of reading, but I am hung up on a piece of code that does not do what I expect. I'm sure I am doing something stupid, but I can't see it... help please? I seem to not be able to pre-load the value of "Delay" in my assembler code.
I should get a 2.5MHz square wave on pin 7 with this code, but I do not. What seems to be happening is that Delay is set to some unknown value and waitcnt is take a VERY long time (expected of course).
If I change the code like this, it works fine.
What newbie mistake am I making?
I have looked at a lot of code examples and done a lot of reading, but I am hung up on a piece of code that does not do what I expect. I'm sure I am doing something stupid, but I can't see it... help please? I seem to not be able to pre-load the value of "Delay" in my assembler code.
I should get a 2.5MHz square wave on pin 7 with this code, but I do not. What seems to be happening is that Delay is set to some unknown value and waitcnt is take a VERY long time (expected of course).
CON _clkmode = xtal1 + pll16x 'Standard clock mode * crystal frequency = 80 MHz _xinfreq = 5_000_000 PUB public_method_name cognew(@entry,0) DAT org 0 entry mov dira, #$80 ' P7 as output mov Time, cnt add Time, Delay loop waitcnt Time, Delay xor outa, #$80 ' toggle P7 jmp #loop Time res 1 Delay long 16
If I change the code like this, it works fine.
CON _clkmode = xtal1 + pll16x 'Standard clock mode * crystal frequency = 80 MHz _xinfreq = 5_000_000 PUB public_method_name cognew(@entry,0) DAT org 0 entry mov dira, #$80 ' P7 as output mov Time, cnt add Time, #16 loop waitcnt Time, #16 xor outa, #$80 ' toggle P7 jmp #loop Time res 1 Delay long 16
What newbie mistake am I making?
Comments
>Delay long 16
reserved space (will be of unkown value) should always be listed last.