View previous topic :: View next topic |
Author |
Message |
jackhammer
Joined: 05 Sep 2011 Posts: 8
|
help me ERROR"Expecting a close paren" |
Posted: Sat Sep 24, 2011 4:50 am |
|
|
Code: | #include <16F877A.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
unsigned char DisBuff[5];
unsigned char Scan_Column[]={0xfe,0xfd,0xfb,0xf7,0xff};
unsigned char SegMent_Code[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
void Decimal_To_7_SegMent(unsigned int16 Num);
void Scan_Display(void);
void main(void)
{
unsigned int16 Number=0000;
set_tris_b(0x00);
set_tris_d(0x00);
while(true)
{
Decimal_To_7_SegMent(Number);
Scan_Display();
Number++;
}
}
void Decimal_To_7_SegMent(unsigned int16 Num)
{
unsigned int16 temp;
DisBuff[0]=SegMent_Code[Num/200];
temp=Num%200;
DisBuff[1]=SegMent_Code[temp/40];
temp=Num%40;
DisBuff[2]=SegMent_Code[temp/6];
temp=Num%40;
DisBuff[3]=SegMent_Code[temp];
}
void Scan_Display(void)
{
int i,j;
for(i=0;i<5;i++)
for(j=0;j<4;j++)
{
output_b(DisBuff[j]);
output_d(Scan_Column[j];
delay_us(200);
output_b(DisBuff[4]);
output_d(Scan_Column[4];
delay_us(200);
}
} |
|
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Sat Sep 24, 2011 5:31 am |
|
|
output_b(DisBuff[j]);
output_d(Scan_Column[j]; <== Missing )
delay_us(200);
output_b(DisBuff[4]);
output_d(Scan_Column[4]; <== Missing )
delay_us(200); _________________ Google and Forum Search are some of your best tools!!!! |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9229 Location: Greensville,Ontario
|
|
Posted: Sat Sep 24, 2011 6:38 am |
|
|
also maybe ...
void main(void)
{
unsigned int16 Number=0000;
set_tris_b(0x00);
set_tris_d(0x00);
while(true)
{
Decimal_To_7_SegMent(Number);
Scan_Display();
Number++;
}
} !!! this could be seen as the end of MAIN ???
Also good idea to put a blank line between functions or blocks of code,easier to read.
And...MPLABv8.66+ has a great feature to highlight the pairs of bracket! Sure makes troubleshooting code easier. |
|
|
jackhammer
Joined: 05 Sep 2011 Posts: 8
|
|
Posted: Sat Sep 24, 2011 6:45 am |
|
|
Thank you very much for all comments |
|
|
jackhammer
Joined: 05 Sep 2011 Posts: 8
|
|
Posted: Sat Sep 24, 2011 9:21 am |
|
|
What do you can change code as clock ? |
|
|
|