PDA

View Full Version : Help with assembler (Resolved, thanks)



Onni
04-29-2008, 03:48 AM
I simply don't get it.

I am trying to write a servo pulse width reader in assembler. So I can send steering·commands to the propeller from my RC-controller.

This little piece of code works:


waitpeq Mask, Mask
mov Data0, cnt
waitpne Mask, Mask
mov Data1, cnt

And then I output (Data1 - Data0) in Spin in another COG to a terminal and se the values change from 1.2 - 1.7mS·when I move the stick.
Great!

But I really want a time out in the waitpeq. If the·transmitter is turned off the signal goes flatline and I want to do other things in this COG.
So I try to break the waitpeq in to pieces so I can insert time out code:



ch0 test Mask, ina wz
if_z jmp ch0
mov Data0, cnt
ch1 test Mask, ina wz
if_nz jmp ch1
mov Data1, cnt
But this code doesn't work! Why?

/Onni


Post Edited (Onni) : 4/28/2008 9:15:23 PM GMT

Lord Steve
04-29-2008, 03:52 AM
Because you need a '#' in front of your labels in the JMP instructions?



ch0 test Mask, ina wz
if_z jmp #ch0
mov Data0, cnt
ch1 test Mask, ina wz
if_nz jmp #ch1
mov Data1, cnt

Onni
04-29-2008, 04:05 AM
Yes, you are right!

And the sad part is that I knew that :)

Thanks!