hua_wind
(stranger)
Mon Nov 05 2007 08:14 PM
why? about hi-tech c for HT

Please use Code tags to maintain formatting and improve code readability. I have added them here. (admin)
Code:
void delay(unsigned char x);

void main()
{
while(1)
{
#asm
MOV a,50
CALL _delay
#endasm
}
}
void delay(unsigned char x)
{
while(x--);
}



编译中...
HI-TECH C COMPILER (Holtek MCU) V9.10PL6
Copyright (C) 1984-2006 HI-TECH SOFTWARE
licensed for evaluation purposes only
this licence will expire on Tue, 04 Dec 2007
: 0: (800) undefined symbol "_delay"
Compilation failed - error code 1


why?


Dan Henry
(Guru)
Mon Nov 05 2007 08:26 PM
Re: why? about hi-tech c for HT

I don't use the Holtek toolchain, but HI-TECH's documentation for other processors has been pretty good about detailing the naming conventions required to interface C to ASM. Does your query originate because of a discrepancy between the toolchain documentation and the toolchain behavior?

Mark Pappin
()
Mon Nov 05 2007 09:32 PM
Re: why? about hi-tech c for HT

Quote:

: 0: (800) undefined symbol "_delay"
why?


Our PRO compilers with OCG (of which the HOLTEK compiler is one) do very aggressive dead-code elimination and if a C function or variable is not accessed from within C code it will probably not exist in the output. Unless you've got a very good reason to do so, you should not try to do stuff with inline assembly code that can much more easily be done in C.

By The Way, you should also avoid using #asm / #endasm close to C flow-control constructs like for, while, if, etc., as recommended in the manual.


hua_wind
(stranger)
Mon Nov 05 2007 09:40 PM
Re: why? about hi-tech c for HT

please explain me the rule of parameters' transmition (from asm to c)
ex:
xyz(unsigned char x,unsigned char y,unsigned char z)


hua_wind
(stranger)
Mon Nov 05 2007 10:01 PM
Re: why? about hi-tech c for HT

in other words,what's the difference between holtek c compile and HI-tech c compile about parameters'transmiting(from asm to c)

C.J. Prins
()
Tue Nov 06 2007 03:04 AM
Re: why? about hi-tech c for HT

I'm using the H8/300H compiler. For that compiler it's better to use the C-function asm() to have assembly lines included. In that way, many problems can be prevented.
For example:

asm("BCLR #7,@_SCI0_SSR"); // TDRE = 0

With kind regards from a rainy Holland.

Cojan Prins.


hua_wind
(stranger)
Tue Nov 06 2007 08:45 PM
Re: why? about hi-tech c for HT

Unless you've got a very good reason to do so, you should not try to do stuff with inline assembly code that can much more easily be done in C.




using by interrupt program.........



Contact Us | Privacy statement HI-TECH Software

Powered by UBB.threads™ 6.5.5