View Full Version : Debug light example bug?

01-26-2008, 08:17 AM
Greetings all!

I've had a Hydra sitting on my shelf for a few months now and I am finally getting around to playing around with it.

Anyways, I typed in the debug LED example on page 191 of the Hydra book. When I compile, the Propeller Tool gives an error on the lines with #!DEBUG_LED_PORT_MASK indicating that "Source register/constant cannot exceed $1FF."

I have tried substituting in $FE and $1FE which will compile fine, but the light does not change brightness.

I'm not sure if I have made a typo that I am not seeing or if the book is wrong. I'd attach my type up of the example, but first what are the rules around here about posting such copyrighted material?


01-26-2008, 08:26 AM
Well, this is one of the very rare examples, where André flopped http://forums.parallax.com/images/smilies/smile.gif
As you most likely know, the space for any operand in a machine instruction is limited to 9 bits, so the error message is o.k.

What to do?
(a) You can use a CELL to keep this large value ($FFFF_FFFE)

AND OUTA , not_one

(b) use another instruction! ANDN is fine:


01-26-2008, 08:47 AM
I just see, this program is more complex than it should... it in fact will only work when the "debug_led-inc" is a power of two, otherwise the ADD debug_led_brightness,.. instruction will rarely produce a zero flag...

I think it is best you design your own LED dimming program!
This example was given to show the interaction between COGS, SPN and asembly code only... Nobody seemed to have tested its functionality