I'm using a 16F676. The program was working fine till I changed the hardware to use PORTA.3 as a digital input to recognize a pushbutton. Now as soon as the button is pressed the whole thing locks up and I have to turn the power off to get it to reset.
I know I need to turn MCLRE off. I think I did that, but obviously I did something wrong or I've left something out. Please help me figure out how to use PORTA.3 as a digital input.
FYI, PORTA.1/AN1 and PORTA.2/AN2 are connected to potentiometers and being used as analog inputs.
Code:#config __CONFIG _CP_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT& _MCLRE_OFF #endconfig ADCON1 = %00000000 ANSEL = %00000110 CMCON = %00000111 TRISA = %00001111 TRISC = %00000000 ' Set TMR0 to interrupt every 16.384 milliseconds OPTION_REG = %10000101 ' Set TMR0 configuration and enable PORTB pullups INTCON = %10100000 ' Enable TMR0 interrupts On Interrupt Goto tickint ' ' Hardware connection ' =================== CS VAR PORTA.5 ' digital potentiometer SPI connection SCK VAR PORTC.2 ' digital potentiometer SPI connection SDI VAR PORTC.1 ' digital potentiometer SPI connection tempobutton var PORTA.0 ' push button 1 tempoLED var PORTC.0 ' push button 1 status LED trailsbutton var PORTA.3 ' push button 2 trailsLED var PORTC.4 ' push button 2 status LED mosA var PORTC.5 ' MOSFET switch A mosB var PORTA.4 ' MOSFET switch B mosC var PORTC.3 ' MSOFET switch C




Bookmarks