ERMEGM
- 16th January 2014, 16:47
Hi Guys,
It should be pretty straight forward, but I'm at a loss. Trying to use a 16F628A and tried searching online for similar issues, but have been unsuccessful in resolving the matter.
I wrote out a large amount of code. Found that one of the outputs on the PIC wasn't doing what it was suppose to do. To make a long story short, I wrote a small bit of code to test the outputs I wanted to control and it's still not working. I tried programming new chips, and get the same result.
My problem: porta.4 (pin 3) does not want to turn on. It stays low and does not activate to control a transistor. I replaced the transistor (in case it was bad), and get the same result. Can someone tell me what I'm missing.
Thanks,
Tony
#CONFIG
__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _LVP_OFF & _CP_OFF & _PWRTE_ON & _MCLRE_OFF & _BOREN_OFF
#ENDCONFIG
Reset:
CMCON = 7 ' Analog comparators off
VRCON = 0 ' A/D Voltage reference disabled
TRISA = %11000001 ' sets pin as input (1) or output (0)
TRISB = %00110011 ' sets pin as input (1) or output (0)
PORTA = %00000000 ' sets outputs as high (1) or low (0)
PORTB = %00000000 ' sets outputs as high (1) or low (0)
' -----[ Variables ]-------------------------------------------------------
rightrelay var porta.1 ' right relay output
leftrelay var portb.2 ' left relay output
rightfet var porta.4 ' right fet output
leftfet var porta.2 ' left fet output
high leftrelay
high rightrelay
action:
low leftfet
high rightfet
pause 500
low rightfet
high leftfet
pause 500
goto action
It should be pretty straight forward, but I'm at a loss. Trying to use a 16F628A and tried searching online for similar issues, but have been unsuccessful in resolving the matter.
I wrote out a large amount of code. Found that one of the outputs on the PIC wasn't doing what it was suppose to do. To make a long story short, I wrote a small bit of code to test the outputs I wanted to control and it's still not working. I tried programming new chips, and get the same result.
My problem: porta.4 (pin 3) does not want to turn on. It stays low and does not activate to control a transistor. I replaced the transistor (in case it was bad), and get the same result. Can someone tell me what I'm missing.
Thanks,
Tony
#CONFIG
__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _LVP_OFF & _CP_OFF & _PWRTE_ON & _MCLRE_OFF & _BOREN_OFF
#ENDCONFIG
Reset:
CMCON = 7 ' Analog comparators off
VRCON = 0 ' A/D Voltage reference disabled
TRISA = %11000001 ' sets pin as input (1) or output (0)
TRISB = %00110011 ' sets pin as input (1) or output (0)
PORTA = %00000000 ' sets outputs as high (1) or low (0)
PORTB = %00000000 ' sets outputs as high (1) or low (0)
' -----[ Variables ]-------------------------------------------------------
rightrelay var porta.1 ' right relay output
leftrelay var portb.2 ' left relay output
rightfet var porta.4 ' right fet output
leftfet var porta.2 ' left fet output
high leftrelay
high rightrelay
action:
low leftfet
high rightfet
pause 500
low rightfet
high leftfet
pause 500
goto action