Hi I wonder if anyone can tell me why my code is mis-behaving. I have a light sensor controlling the brightness of some LED's. I am using the 28x1 chip because I need 2 pwm outputs. As the light dims the LEDs fade off but after they have faded off they then start flashing full brightness - I dont want this, i just want them to stay off. I have put constraints on b1 so when there is no light the lights should just stay off I have tried putting constraints on both b1 and w1 but it still goes weird. When there is no light w1 starts giving values of around 65500. The LDR is connected to ADC1 and the LEDs to PWM1 (PORTC 1). Anyway here is the code:
-----------------------------------
main:
readadc 1, b1
debug b1
w1 = b1 - 180 *3
pwmout 1,255,w1
if b1 =>0 and b1=<175 then goto off1
if w1 =>65300 then goto off1
goto main
off1:
low portc 1
goto main
----------------------------------------------------
Any ideas?
Mike
-----------------------------------
main:
readadc 1, b1
debug b1
w1 = b1 - 180 *3
pwmout 1,255,w1
if b1 =>0 and b1=<175 then goto off1
if w1 =>65300 then goto off1
goto main
off1:
low portc 1
goto main
----------------------------------------------------
Any ideas?
Mike