2013년 1월 14일 월요일

AVR inline assembly

http://www.nongnu.org/avr-libc/

/**
 * \file
 *
 * \brief Empty user application template
 *
 */

/*
 * Include header files for all drivers that have been imported from
 * Atmel Software Framework (ASF).
 */
#include
unsigned char ac,b,c,d,e;
unsigned short aaa;
volatile unsigned char sub(unsigned char a, unsigned char b);

int main (void)
{
board_init();


ac=0x13;
b=0x97;
c=3;
d=3;
e=4;




//c=sub(d,e);

//c=sub(ac,b);

c=sub(d,e);

e=ac+b;

asm(
"brcc LO"
);
d=e++;

asm(
"LO:"
);

//d=c+ac;


// Insert application code here, after the board has been initialized.
}


volatile unsigned char sub(unsigned char a, unsigned char b){
//unsigned char c;
// c=a-b;
return a-b;

}

댓글 없음:

댓글 쓰기