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++);
}
}
 
Top