hi
i want to combine a c file whit asm file in avrstudio5
well,i creat a c file and wrie c code then creat a asm file in this project and write asm code like this follow:
c code :
#includevolatile uint8_t pinbits; //define poer pins extern void InitPort(void);//init port for output extern void sendpinbits(void);//send to port int main() { pinbits=1;//set pin 1 as output InitPort();//call subroutine from assembler file while(1)//repeat for ever { pinbits=1;//Pin High sendpinbits();//call subroutine from assembler file pinbits=0;//Pin Low sendpinbits();//call subroutine from assembler file } }
asm code :
.include "m16def.inc" .extern pinbits ;external variable .global InitPort ;make accesible globally InitPort: ;function name push r18 ;save register value lds r18, pinbits ;load variable to r18 out _SFR_IO_ADDR(DDRD), r18 ;set pins as output pop r18 ;restore register ret ;return from subroutine .global sendpinbits ;make global sendpinbits: ;function name push r18 ;save register value lds r18, pinbits ;load variable to r18 out _SFR_IO_ADDR(PORTD), r18 ;pins to High pop r18 ;restore register ret ;return from subroutine
then in project propertise in toolchian tab import flag of asm file like this follow:
but when i want to assmble software unknown .extern and .global in asm file !????
thanks than you'r attention