When I give PORTA.1 +5V, LED1 dosent shine..
Whats wrong with my code?
Code:LED1 var PORTB.1 PRESS var PORTA.1 loop: If press = 1 then high led1 else low led1 endif goto loop end
When I give PORTA.1 +5V, LED1 dosent shine..
Whats wrong with my code?
Code:LED1 var PORTB.1 PRESS var PORTA.1 loop: If press = 1 then high led1 else low led1 endif goto loop end
Does your PIC have ADC?
If it does...
http://www.picbasic.co.uk/forum/showthread.php?t=562
http://www.picbasic.co.uk/forum/showthread.php?t=561
Dave
Always wear safety glasses while programming.
According to the data sheet it has two comparators.
The above links will explain why
CMCON=7
is needed.
Dave
Always wear safety glasses while programming.
Ok, thanks.
But it still dosent work as I want it :/
When i transfer it LED1 starts to shine directly even if PortA.1 doesnt have +5VCode:@ device pic16F648A, hs_osc, wdt_off, mclr_on, lvp_off, protect_off DEFINE OSC 20 LED1 var PORTB.1 PRESS var PORTA.1 CMCON=7 loop: If press=1 then high led1 else low led1 endif goto loop end
:/
Maybe the LED is backwards
Do you have PORTA.1 tied to ground with a resistor (10K) so it is not floating?
Dave
Always wear safety glasses while programming.
Bookmarks