Quantcast
Channel: MEL PICBASIC Forum
Viewing all articles
Browse latest Browse all 4787

16F1829 PORTA.5 problem

$
0
0
Hello Folks,
I'm struggling a few days how to set port RA5 on PIC 16F1829 as general purpose I/O (output).
I try everything but no succes, I think the problem is around oscillator configuration, because the pin still in CLKIN state (or something else), not as gen. purpose I/O.
Please, can someone help me with proper configuration.
Here is the test code, and config:
Code:

; MCU PIC16F1829                                       
 
#CONFIG
cfg= _FOSC_INTOSC
cfg&= _WDTE_OFF
cfg&= _PWRTE_OFF
cfg&= _MCLRE_OFF
cfg&= _CP_OFF
cfg&= _CPD_OFF
cfg&= _CLKOUTEN_OFF
cfg&= _IESO_OFF
cfg&= _FCMEN_OFF
#ENDCONFIG

DEFINE OSC 8    ; Use a 8 MHZ internal clock
OSCCON = %01110000
CLKRCON = 0
APFCON0 = 0 
APFCON1 = 0
CM1CON0 = 0

CCP1CON = %00000000
CCP2CON = %00000000
ANSELA = %00000000
ANSELB = %00000000
ANSELC = %00000000
TRISA = %000000
TRISB = %00000000     
TRISC = %00000000
CM1CON0 = 0      ; Disable comparator 1
CM2CON0 = 0      ; Disable comparator 2
OPTION_REG.6=0
OPTION_REG.7=1

led var porta.5

main:
high led
pause 500
low led
pause 500
goto main


Viewing all articles
Browse latest Browse all 4787

Trending Articles