This is simple Led-blink code that does not work.
LED5 flashes normally, and LED 4 stable HIGH.................
Using a 12F1822 (RA4 is not open collector in this PIC).
Code:
ASM
__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_ON & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
__CONFIG _CONFIG2, _WRT_OFF & _PLLEN_ON & _STVREN_OFF & _BORV_HI & _LVP_OFF
ENDASM
DEFINE OSC 32
LED5 VAR PORTA.5
LED4 VAR PORTA.4
OSCCON = %01110000
ANSELA = %00000011 ' AN0 = ANALOG PIN , C1IN0- = ANALOG PIN
TRISA = %00000000
LOOPA:
LED4 = 1
LED5 = 1
PAUSE 100
LED4 = 0
LED5 = 0
PAUSE 100
GOTO LOOPA
when LOOPA modified as above works fine and both LEDs blinking.
Code:
LOOPA:
LED4 = 1
LED5 = 1
PAUSE 100
LED4 = 0
PAUSEUS 2 <---
LED5 = 0
PAUSE 100
GOTO LOOPA
EDIT : instead of the 2us pause , i tried another command like modifying a variable , XX = 1 and still works.
So the conclusion is , two LEDx = 0 commands in the row cannot be processed normally (although LEDx = 1 works) .
The UFO's coming ...
Cheers!
Bookmarks