I have a funny issue I have been dealing with for some time and can't figure it out.
I am using a 16F1829 and have the LED on porta.5
During my startup routine, I have porta.5 setup for digital, no pull ups, the latch register is set to low and the tris register is set for input.
When I turn on a feature on my project, I turn the LED on by flipping the tris register to an output. This lets the customer know that the feature is on.
Now when they press another button, the code does a jump (gosub) to a routine. When this happens, it turns the LED off.
For the life of me, I can't understand why.
Here is my startup configuration
Code:DEFINE OSC 32 PORTA = 0 PORTB = 0 PORTC = 0 '*************************************************************** '*****************CONFIGURATION WORDS IN INCLUDE**************** '*************************************************************** '__CONFIG _CONFIG1, _FCMEN_ON, _IESO_OFF, _CLKOUTEN_OFF, _BOREN_OFF, _CPD_OFF, _CP_OFF, _MCLRE_ON, _PWRTE_OFF, _WDTE_OFF, _FOSC_INTOSC '__CONFIG _CONFIG2, _LVP_ON, _BORV_19, _STVREN_OFF, _PLLEN_ON, _WRT_OFF '*************************************************************** '********************SET STANDARD REGISTERS********************* '*************************************************************** ''''''OSCILLATOR REGISTERS''''' OSCCON = %11110000 OSCTUNE = %011111 ''''''PORT REGISTERS''''''''''' OPTION_REG = %00000000 ADCON0 = %00000000 ADCON1 = %00000000 DACCON0 = %00000000 DACCON1 = %00000000 SRCON0 = %00000000 SRCON1 = %00000000 INTCON = %00000000 FVRCON = %00000000 MDCON = %00000000 BORCON = %00000000 SRCON0 = %00000000 SRCON1 = %00000000 PIE1 = %00000000 PIE2 = %00000000 PIE3 = %00000000 PIE4 = %00000000 CM1CON0 = %00000000 CM1CON1 = %00000000 CM2CON0 = %00000000 CM2CON1 = %00000000 '*************************************************************** '********************SET PORTS********************************** '*************************************************************** ''''''PORTA SETUP'''''''' ANSELA = %00000000 WPUA = %11001010 INLVLA = %00000000 LATA = %00010000 TRISA = %11111111 ''''''PORTB SETUP'''''''' ANSELB = %00000000 WPUB = %11001111 INLVLB = %01110000 LATB = %00000000 TRISB = %11111111 ''''''PORTC SETUP'''''''' ANSELC = %00000000 WPUC = %11111001 INLVLC = %00000000 LATC = %00000110 TRISC = %11111111




Bookmarks