PDA

View Full Version : 16F876A Configuration



RFEFX
- 29th November 2006, 17:52
Ok,
So please bare with me... I am a previous Basic Stamp II Junkie (tired of buying $50 Stamps) and you can say i have finally stepped into the light. I am learning the whole PIC programming thing.

I have recently fabbed a new circuit board using the 16F876A PIC QFN28 Package.

Heres problem 1:
PORTA 0,1,2,3,4 are being used as outputs. PORTA.4 can't get it to output.
using PicBasic Pro i have included ADCON1=7 at the top of the program along with TRISA=%00000000

Heres Problem 2:
PORTC 7,6,5,4,3 are used as inputs and are being driven by a Holtek Decoder.
So far PORTC.3 and 4 are the only ones actually working. I have set TRISC=%11111111 at the top of the program.

Sample program:
In the program below I have the 5 logic inputs coming from the Decoder to PORTC 3-7. when only 3 and 4 actually get read by the PIC (Problem 2). PORTB.5 and PORTA.4 are connected to LEDs. Only PORTB.5 turns on (Problem 1).

Thanks for any help.

'''''''''''''''''''''''''''''''''''''''''
ADCON1=7
CMCON=7
TRISA=%00000000
TRISC=%11111111

main:
low PORTB.5
low PORTA.4
if portc.7 = 1 then led:
if portc.6 = 1 then led:
if portc.5 = 1 then led:
if portc.4 = 1 then led:
if portc.3 = 1 then led:
goto main:

led:
HIGH PORTA.4
HIGH PORTB.5
goto main:

Archangel
- 29th November 2006, 18:30
Hi RFEFX,

Heres problem 1:
PORTA 0,1,2,3,4 are being used as outputs. PORTA.4 can't get it to output.
using PicBasic Pro i have included ADCON1=7 at the top of the program along with TRISA=%00000000 is your OUTPUT AN OUTPUT LOGIC 1,, port A4 on most PIC requires an external pullup and will only switch low(open drain)and will sink current, not supply.

Heres Problem 2:
PORTC 7,6,5,4,3 are used as inputs and are being driven by a Holtek Decoder.
So far PORTC.3 and 4 are the only ones actually working. I have set TRISC=%11111111 at the top of the program.
If you have a logic probe or DVM check the port status and the output of encoder, you may need to pull port up or down with resistors