Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 11, 2016, 05:15:04 05:15


Login with username, password and session length


Pages: [1]
Print
Author Topic: Keil C error,help me!  (Read 3345 times)
0 Members and 1 Guest are viewing this topic.
94491203
Junior Member
**
Offline Offline

Posts: 70

Thank You
-Given: 5
-Receive: 21



« on: September 24, 2009, 05:43:04 17:43 »

compiling C:\Keil\C51\INC\Atmel\at89c51xd2.h...
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(19): error C156: 'P0_7': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(20): error C156: 'P0_6': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(21): error C156: 'P0_5': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(22): error C156: 'P0_4': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(23): error C156: 'P0_3': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(24): error C156: 'P0_2': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(25): error C156: 'P0_1': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(26): error C156: 'P0_0': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(30): error C156: 'P1_7': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(31): error C156: 'P1_6': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(32): error C156: 'P1_5': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(33): error C156: 'P1_4': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(34): error C156: 'P1_3': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(35): error C156: 'P1_2': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(36): error C156: 'P1_1': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(37): error C156: 'P1_0': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(42): error C156: 'P2_7': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(43): error C156: 'P2_6': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(44): error C156: 'P2_5': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(45): error C156: 'P2_4': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(46): error C156: 'P2_3': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(47): error C156: 'P2_2': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(48): error C156: 'P2_1': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(49): error C156: 'P2_0': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(54): error C156: 'P3_7': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(55): error C156: 'P3_6': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(56): error C156: 'P3_5': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(57): error C156: 'P3_4': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(58): error C156: 'P3_3': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(59): error C156: 'P3_2': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(60): error C156: 'P3_1': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(61): error C156: 'P3_0': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(63): error C156: 'RD': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(64): error C156: 'WR': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(65): error C156: 'T1': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(66): error C156: 'T0': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(67): error C156: 'INT1': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(68): error C156: 'INT0': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(69): error C156: 'TXD': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(70): error C156: 'RXD': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(73): error C156: 'P4_7': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(74): error C156: 'P4_6': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(75): error C156: 'P4_5': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(76): error C156: 'P4_4': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(77): error C156: 'P4_3': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(78): error C156: 'P4_2': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(79): error C156: 'P4_1': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(80): error C156: 'P4_0': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(83): error C156: 'P5_7': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(84): error C156: 'P5_6': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(85): error C156: 'P5_5': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(86): error C156: 'P5_4': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(87): error C156: 'P5_3': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(88): error C156: 'P5_2': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(89): error C156: 'P5_1': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(90): error C156: 'P5_0': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(95): error C156: 'CY': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(96): error C156: 'AC': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(97): error C156: 'F0': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(98): error C156: 'RS1': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(99): error C156: 'RS0': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(100): error C156: 'OV': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(101): error C156: 'UD': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(102): error C156: 'P': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(116): error C156: 'TF1': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(117): error C156: 'TR1': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(118): error C156: 'TF0': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(119): error C156: 'TR0': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(120): error C156: 'IE1': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(121): error C156: 'IT1': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(122): error C156: 'IE0': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(123): error C156: 'IT0': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(128): error C156: 'TF2': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(129): error C156: 'EXF2': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(130): error C156: 'RCLK': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(131): error C156: 'TCLK': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(132): error C156: 'EXEN2': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(133): error C156: 'TR2': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(134): error C156: 'C_T2': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(135): error C156: 'CP_RL2': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(152): error C156: 'SM0': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(153): error C156: 'FE': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(154): error C156: 'SM1': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(155): error C156: 'SM2': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(156): error C156: 'REN': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(157): error C156: 'TB8': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(158): error C156: 'RB8': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(159): error C156: 'TI': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(160): error C156: 'RI': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(183): error C156: 'EA': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(184): error C156: 'EC': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(185): error C156: 'ET2': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(186): error C156: 'ES': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(187): error C156: 'ET1': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(188): error C156: 'EX1': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(189): error C156: 'ET0': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(190): error C156: 'EX0': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(214): error C156: 'CF': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(215): error C156: 'CR': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(217): error C156: 'CCF4': invalid 'sbit' declaration
C:\KEIL\C51\INC\ATMEL\AT89C51XD2.H(218): error C156: 'CCF3': invalid 'sbit' declaration
SfrCC FATAL-ERROR -
  ACTION:  PARSING SOURCE-FILE
  ERROR:    (LINE 218), MORE THAN 400 ERRORS IN SOURCE-FILE
SfrCC TERMINATED.


WHY?
Logged
zorx
Active Member
***
 Muted
Offline Offline

Posts: 121

Thank You
-Given: 48
-Receive: 163


« Reply #1 on: September 24, 2009, 06:36:35 18:36 »

Can you be more specific about your KEIL project files?
You are not trying to compile the header file "at89c51xd2.h" itself, right?
Logged
sam_des
Active Member
***
Offline Offline

Posts: 221

Thank You
-Given: 47
-Receive: 111


« Reply #2 on: September 24, 2009, 07:59:21 19:59 »

Hi,

Why are you trying to compile header file(*.h) Huh
Include it in your *.c file & then compile .c file  Wink

Hope that helps...

regards,
sam_des
Logged

Never be afraid to do something new. Remember Amateurs built the Ark, Professionals built the Titanic !
94491203
Junior Member
**
Offline Offline

Posts: 70

Thank You
-Given: 5
-Receive: 21



« Reply #3 on: September 25, 2009, 02:29:24 14:29 »

Can you be more specific about your KEIL project files?
You are not trying to compile the header file "at89c51xd2.h" itself, right?

NO,my files
--------------------------------------
#include "AT89C51XD2.h"
#include "intrins.h"
#define uchar unsigned char

void mDelay(unsigned int DelayTime)
{ unsigned int j=0;
   for(;DelayTime>0;DelayTime--)
   { for(j=0;j<125;j++)
   {;} }}

uchar Key()                  
{ uchar KeyV;
uchar tmp;
P3=P3|0x3c;
KeyV=P3;
if((KeyV|0xc3)==0xff)
return(0);
mDelay(10);
KeyV=P3;
if((KeyV|0xc3)==0xff)
return(0);
else
{ for(;Wink{ tmp=P3;
if((tmp|0xc3)==0xff)
break;}
return(KeyV);}}

void main()
{ unsigned char OutData=0xfe;
bit UpDown=0;
bit Start=0;
uchar KValue;
for(;Wink
{ KValue=Key();
switch (KValue)
{ case 0xfb: //P3.2=0,Start
{ Start=1;
break; }
case 0xf7: //P3.3=0,Stop
{ Start=0;
break; }
case 0xef: //P3.4=0 Up
{ UpDown=1;
break; }
case 0xdf: //P3.5=0 Down
{ UpDown=0;
break; }
}
if(Start)
{ if(UpDown)
OutData=_crol_(OutData,1);
else
OutData=_cror_(OutData,1); P1=OutData;
}
else
P1=0xff;
mDelay(1000);
}
}
Logged
metal
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2018

Thank You
-Given: 514
-Receive: 477


Top Topic Starter


« Reply #4 on: September 25, 2009, 02:54:28 14:54 »

Upload your project as an attachment.
Logged

nothing to say..
94491203
Junior Member
**
Offline Offline

Posts: 70

Thank You
-Given: 5
-Receive: 21



« Reply #5 on: September 25, 2009, 03:37:00 15:37 »

OH,I find this error,this files in uVision4 is error,but uVision3 is good
« Last Edit: September 25, 2009, 03:39:48 15:39 by 94491203 » Logged
metal
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2018

Thank You
-Given: 514
-Receive: 477


Top Topic Starter


« Reply #6 on: September 25, 2009, 04:27:41 16:27 »

It was so much difficult for you to zip project files and upload it here; nonetheless, you opted to upload main.c file only thinking that we are going to create uV project for you and test your code. It was that we requested you to upload the project so we can help you. And can you tell us why uV3 is good while uV4 generates errors ?

 
Logged

nothing to say..
94491203
Junior Member
**
Offline Offline

Posts: 70

Thank You
-Given: 5
-Receive: 21



« Reply #7 on: September 25, 2009, 05:23:24 17:23 »

Sorry,

error is stop debug Session in uVision4
Logged
sam_des
Active Member
***
Offline Offline

Posts: 221

Thank You
-Given: 47
-Receive: 111


« Reply #8 on: September 26, 2009, 08:37:56 20:37 »

Hi,

I am not going to bother checking that project.
Man, what a horror  Angry Do you know there is something known as 'indention'  Undecided
Your code is absolutely unreadable. No wonder you're facing troubles while debugging this mess  Cry
Keep in mind that more clear & readable code you write, more easy it'll be to test & debug it for you as well as for others.

Still I am going to give few suggestions to you..
1) AT89C51XD2.h & intrins.h are compiler's native headers, so they must be within <> & not "".
2) Use typedef to define your own variable types & not #define.
3) Though it is acceptable always specify void when defining functions not having arguments,
4) Go find & use some good "programming styles". C is already famous(!?) for its read-only programs, but we certainly don't want to add to its (ill)fame.

regards,
sam_des
« Last Edit: September 26, 2009, 08:40:25 20:40 by sam_des » Logged

Never be afraid to do something new. Remember Amateurs built the Ark, Professionals built the Titanic !
metal
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2018

Thank You
-Given: 514
-Receive: 477


Top Topic Starter


« Reply #9 on: September 27, 2009, 07:41:58 07:41 »

There is a standard for writing C code. Search for it and read it.
Logged

nothing to say..
chinninitin
Active Member
***
 Muted
Offline Offline

Posts: 136

Thank You
-Given: 145
-Receive: 37



« Reply #10 on: November 14, 2009, 07:41:54 07:41 »

C51.RAR

working fine without any modifications,,

Build target 'AT89C51ID2'
compiling Main.c...
linking...
Program Size: data=10.2 xdata=0 code=182
creating hex file from "C51_Template"...
"C51_Template" - 0 Error(s), 0 Warning(s).

I am using C51.  8.16 VERSION with uVision 3


chinni
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC