Help for the Embedded -C for KIEL (Switch Program code)

Thread Starter

mkbutan

Joined Sep 30, 2008
299
I am reading the book (PDF) Embedded - C by Michael J.
(these are not my coed's I have just coped from the above book)
I have Keil μVer -4 but these code's give error as below
--------------------
Build target 'Target 1'
linking...
*** ERROR L127: UNRESOLVED EXTERNAL SYMBOL
SYMBOL: ?C_START
MODULE: STARTUP.obj (?C_STARTUP)
*** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL: ?C_START
MODULE: STARTUP.obj (?C_STARTUP)
ADDRESS: 100080AH
Program Size: data=9.0 xdata=0 const=0 code=15
Target not created
------------------
I am not able to run these coed in simulator pl help what's going wrong?
the coed are as follows
Rich (BB code):
#include<reg52>
//connect switch to this pin
sbit switch_pin = p1^0;
//display count (binary) on this port
#define count_port p3
//return values from switch_get_input()
#define switch_not_pressed (bit) 0
#define switch_prssed (bit) 1
//function prototypes
void switch_input(void);
bit switch_get_input(const unsigned char);
void display_count_init(void);
void display_count_update(const unsigned char);
void delay_loop_wait(count unsigned int);
void main(void)
{
unsined char switch_presses = 0;
// init function
switch_init();
pisplay_count_init();
while(1)
{
if (switch_get_input(30) == switch_pressed)
{
switch_presses++;
}

display_count_update(switch_presses);
}
}
void switch_init(void)
{
switch_pin = 1;
}
bit switch_get_input(count unsigned char debounce_period)
{
bit return_value = switch_not_pressed;
if (switch_pin == 0)
{
//switch is pressed
//debounce - just wait...
delay_loop_wait(debounce_period);
//check switch again
if (switch_pin ==0)
{
//wait until the switch is relised.
while(switch_pin ==0);
return_value = switch_pressed;
}
}
//now (finelly) return switch value
return returen_value;
}
void display_count_init(void)
{
count_port = 0x00;
}
void display_count_update(const unsigned char count)
{
count_port = count;
}
void delay_loop_wait(const unsigned int delay_ms)
{
unsigned int x, y;
for (x = 0; x<=delay_ms;x++)
{
for (y = 0; y<=120; y++);
}
}
 

ErnieM

Joined Apr 24, 2011
8,377
I don't use that compiler so sorry I can't give you any exact help. "C_StARTUP" sounds like some code all C compilers are supposed to insert into your project to do some housekeeping functions, such as define the variables, set up the stack, and other "behind the scene" things.

HOW that module gets linked into your code I do not know, it would perhaps be in the build settings, but I don't have any idea how your compiler sets this up.
 
Top