junkie_
Junior Member level 2
Dear board,
I am back with another problem with the code mentioned below:
Code was compiling fine before I added "secten" now I am getting the following compile error:
its is PIC16F876A and compiler is MPLAB PIC C Pro.
I am back with another problem with the code mentioned below:
Code:
#include<pic.h> //Define PIC Registers
__CONFIG(0x3f72);//HS oscillator, Enable(PWRTE,BOREN),
//Disable(CPD,CP,WDTEN,In-circuit Debugger)
#define CNTRL_PORT PORTA
#define DATA_PORT PORTB
void hex2dec(unsigned char);
void send_seg(unsigned char,unsigned char,
unsigned char,unsigned char);
void DelayMs(unsigned int);
unsigned char x;
unsigned char hourt=0,hour=0,minten=0,minute=0 ,secten=0;
unsigned char CA[10] =
{0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
//unsigned char CC[10] =
//{0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
unsigned char CA_CNTRL[5] = {0x1F,0x2F,0x37,0x3B,0x3D};
//unsigned char CC_CNTRL[4] = {0x08,0x04,0x02,0x01};
unsigned char n=1;
void main()
{
// unsigned char number;
nRBPU =0;
TRISB=0x00; //PORTB configured as O/P
ADCON1=0x07; //Configure PORTA & PORTE as Digital port
TRISA=0x00; //PORTA Configured as O/P
while(1)
{
if(x == 200)
{
x=0;
secten++; //Inc the value upto 9 in unit place
if(secten>9)
{
minute++; //Inc the value upto 9 in unit place
if(minute>9)
{
minute=0;
minten++; //Inc the value upto 9 in Tenth place
if(minten>9)
{
minten=0;
hour++;//Inc the value upto 9 in Hundredth
if(hour>9)
{
hour=0;
hourt++;//Inc value upto 9 in hourtsandth
if(hourt>9)
hourt=0;
}
}
}
}
}
x++;
send_seg(hourt,hour,minten,minute,secten);
}
}
void send_seg(unsigned char hourt,unsigned char hour,
unsigned char minten,unsigned char minute,unsigned char secten)
{
if(n==1)
{
CNTRL_PORT=CA_CNTRL[0];//Enable unit place
DATA_PORT=CA[secten]; //Display Unit Place Number
n=2;
DelayMs(2);
}
else if(n==2)
{
CNTRL_PORT=CA_CNTRL[1];//Enable 10th place
DATA_PORT=CA[minute]; //Display Tenth Place Number
n=3;
DelayMs(2);
}
else if(n==3)
{
CNTRL_PORT=CA_CNTRL[2];
//Eanble Hundredth place 7-Segment
DATA_PORT=CA[minten];
//Display Hundredth Place Number
n=4;
DelayMs(2);
}
else if(n==4)
{
CNTRL_PORT=CA_CNTRL[3];
//Enable Thousandth place 7-Segment
DATA_PORT=CA[hour];
//Display Thousandth Place Number
n=1;
DelayMs(2);
}
else if(n==5)
{
CNTRL_PORT=CA_CNTRL[4];
//Enable Thousandth place 7-Segment
DATA_PORT=CA[hourt];
//Display Thousandth Place Number
n=1;
DelayMs(2);
}
}
void DelayMs(unsigned int Ms)
{
int delay_cnst;
while(Ms>0)
{
Ms--;
for(delay_cnst = 0;delay_cnst <120;delay_cnst++);
}
}
Code was compiling fine before I added "secten" now I am getting the following compile error:
Code:
Error [186] D:\Emergency Move\Personal\New Electronics\7 Segments XC8\My own Code\main.c; 56.41 too many function arguments
Error [984] D:\Emergency Move\Personal\New Electronics\7 Segments XC8\My own Code\main.c; 61.1 type redeclared
Error [1098] D:\Emergency Move\Personal\New Electronics\7 Segments XC8\My own Code\main.c; 61.1 conflicting declarations for variable "send_seg" (D:\Emergency Move\Personal\New Electronics\7 Segments XC8\My own Code\main.c:9)
Error [253] D:\Emergency Move\Personal\New Electronics\7 Segments XC8\My own Code\main.c; 61.1 argument list conflicts with prototype
its is PIC16F876A and compiler is MPLAB PIC C Pro.