minhduc515
New Member
Hello guys... I'm new with microcontroller and i get some issue with CCS C compiler
I have downloaded an code folder for 16f877a, which is contain that following C soure file
. I test on proteus and it works well..
But i when i re-complie that C Soure File, it has some error
How can i fix this issue ? and why it still running well in proteus , even it doesn's have header (#include <16f877a.h> ...... )?
I have downloaded an code folder for 16f877a, which is contain that following C soure file
Code:
float phaseA,phaseB,phaseC;
#define pa RB4_bit
#define pb RB1_bit
#define pc RB0_bit
#define role RB3_bit
#define phase 311.23
void main() {
C1INV_bit=0;
C2INV_bit=0;
TRISB=0;
pa=0;
pb=0;
pc=0;
role=0;
ADC_Init();
while(1)
{
phaseA=(ADC_Read(5)*5.0/1023)*101;
phaseB=(ADC_Read(1)*5.0/1023)*101;
phaseC=(ADC_Read(4)*5.0/1023)*101;
if(phaseA>1.1*phase||phaseB>1.1*phase||phaseC>1.1*phase||phaseA<0.9*phase||phaseB<0.9*phase||phaseC<0.9*phase)
{
delay_ms(2);
if(phaseA>1.1*phase||phaseB>1.1*phase||phaseC>1.1*phase||phaseA<0.9*phase||phaseB<0.9*phase||phaseC<0.9*phase)
{
role=1;
if(phaseA>1.1*phase)
{
pa=1;
}
else
{
pa=0;
}
if(phaseB>1.1*phase||phaseB<0.9*phase)
{
pb=1;
}
else
{
pb=0;
}
if(phaseC>1.1*phase||phaseC<0.9*phase)
{
pc=1;
}
else
{
pc=0;
}
}
else
{
role=0;
}
}
}
}
But i when i re-complie that C Soure File, it has some error
How can i fix this issue ? and why it still running well in proteus , even it doesn's have header (#include <16f877a.h> ...... )?