sahu
Member
I tried to use the below given code to PIC 16F72.
BUT RA3 & RA5 are not Work as output. Can anyone tell why?
where i has wrong ?
but when i use as below
Code:
#include <htc.h>
#include <PIC16F72.h>
__CONFIG(FOSC_HS & WDTE_OFF & PWRTE_OFF & CP_OFF & BOREN_ON);
#define _XTAL_FREQ 4000000
#define HI_CUT 208//adc=245*17/20 //250
#define OLD 100
#define LO_CUT 60
#define NORMAL_LED RA5 //RB1
#define ERRORE_LED RA4
#define OP_LOAD_RELAY RA3 //RB2
#define C_100 RB5
#define C_10 RB6
#define C_1 RB7
.
.
.
.
.
void main()
{
TRISB = 0x01;
TRISC = 0x00;
TRISA = 0xC7; //RA0 to RA2 as adc & RA3 to RA5 as o\p
GIE = 1;
PEIE = 1;
T0IF = 0;
OPTION_REG = 0x07;
T0IE = 1;
TMR2IE = 1;
TMR2IF = 0;
TMR1IF = 0;
TMR1IE = 1;
T1CON = 0x34;
INTF = 0;
INTEDG = 0;
INTE = 1;
T0CS = 1;
NORMAL_LED = 1;
ERRORE_LED = 1;
OP_LOAD_RELAY = 0;
C_100 = 1;
C_10 = 1;
C_1 = 1;
ADC_Init();
.
.
.
.
.
.
where i has wrong ?
but when i use as below
work fine .#define NORMAL_LED RB1
#define ERRORE_LED RA4
#define OP_LOAD_RELAY RB2