We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
code is:
#include <AT89X52.H> #include "system.h" #include "displej.h"
const uchar brojevi[] = {63, 6, 91, 79, 102, 109, 125, 39, 127, 111}; ispisuje odredjeni broj
extern uchar vreme[6];
void prikazi_vreme(char ofset) { uchar vert=P1; uchar broj; char pom=0;
P2=0x00; if(vert&0x01) pom=1; vert<<=1; vert=vert|0x02; if(!(vert&0x80)) vert=0xfc; vert&=0xfe; switch(vert) { case 0xfc: broj=vreme[ofset]/10; broj=brojevi[broj]; break; case 0xfa: broj=vreme[ofset]%10; broj=brojevi[broj]; break; case 0xf6: broj=vreme[ofset+1]/10; broj=brojevi[broj]; break; case 0xee: broj=vreme[ofset]%10; broj=brojevi[broj]; break; case 0xde: broj=vreme[ofset+2]/10; broj=brojevi[broj]; break; case 0xbe: broj=vreme[ofset]%10; broj=brojevi[broj]; break; default: break; } if(pom) vert|=0x01; P1=vert; P2=broj; }
void displej_handler(char v_d) { switch(v_d) { case 0: prikaz_vremena(0); break; case 1: prikaz_vremena(3); default:; } }
error while compiling:
compiling Display.c... DISPLAY.C(5): error C244: 'brojevi': can't initialize, bad type or class DISPLAY.C(5): error C132: 'brojevi': not in formal parameter list DISPLAY.C(7): error C127: 'vreme': invalid storage class DISPLAY.C(10): error C132: '_prikazi_vreme': not in formal parameter list DISPLAY.C(10): error C141: syntax error near '{' DISPLAY.C(11): error C136: 'vert': 'void' on variable DISPLAY.C(11): error C244: 'vert': can't initialize, bad type or class DISPLAY.C(11): error C136: 'vert': 'void' on variable DISPLAY.C(11): error C132: 'vert': not in formal parameter list DISPLAY.C(12): error C132: 'broj': not in formal parameter list DISPLAY.C(13): error C244: 'pom': can't initialize, bad type or class DISPLAY.C(13): error C132: 'pom': not in formal parameter list DISPLAY.C(15): error C244: 'P2': can't initialize, bad type or class DISPLAY.C(15): error C132: 'P2': not in formal parameter list DISPLAY.C(16): error C141: syntax error near 'if' DISPLAY.C(16): error C141: syntax error near '&', expected ')' DISPLAY.C(17): error C129: missing ';' before '<<='
question is: "What is wrong here?" Why compiler thinks that "brojevi" is function? If anyone know the answer please help! Thanks.
Did you read the description of error C244?
What did it tell you?
#define uchar unsigned char
Why are you using #define rather than typedef?
"I think that code is great but uKeil can't recognize some of basic 'c' operators like '<<=' or '&'"
No, C51 understands them perfectly!
"There must be some file problem."
Indeed - but it is impossible for anyone else to say what it might be without seeing your files!
Always some zero problems.I thought that problem is with ANSI hehe
But edification is,when problem is in 1. variable of code look in h file. (Hehe I know that and before... :) what a day...