Hi All,
Below is my code for turning on and off the landing lights of an RC model, however, I find the lights turning on and off randomly.... ??? ... confused...
I'm using a 12F675, the pin connections as follows:
GPIO.0, 1, 4 and 5 have LEDs connected (landing LEDs on gpio.4) all via the respective Resistors.
GPIO.3 is connected to the RC input through a 1k Res (i've tried it direct)
The program responds as expected on the RC input however on either side of the switch (on or off) the lights randomly turn on (when they are sposed to be off) and off (when they are sposed to be on.)
There is nothing connected the GPIO.2, however I am not sure if tis "open" pin could be causing it.
I checked with the scope and the input signal seems to be stable, just dont know why the signal seems to be jumping within the pic, any ideas?
Many thanks
Rob
Code:@ DEVICE INTRC_OSC, MCLR_off, PROTECT_OFF, WDT_ON, PWRT_ON, BOD_ON CMCON = 7 ' Comparators OFF ANSEL = 0 ' A/D OFF -- Port pins all digital TRISIO = %001000 ' All output but GPIO3 = input GPIO = %000000 ' All 0 on boot ADCON0 = 0 WPU = 0 DATA @1,$FF, $FF 'DEFINE PULSIN_MAX 3000 wing_led2 Var GPIO.5 land_led1 VAR GPIO.4 tail_Led VAR GPIO.0 strob_led VAR GPIO.1 servoin VAR GPIO.3 p var word '--------------------------------------------------------- start: '--------------------------------------------------------- Pause 200 ' Stabilisation at startup p = 0 High wing_led2 High tail_led PulsIn servoin,1,P SELECT CASE p CASE is >160 HIGH land_led1 Case is <130 LOW land_led1 End select Low strob_led pause 250 High strob_led pause 100 low strob_led GOTO start End





Bookmarks