ArduinoUno "Blink"嵌入汇编代码
直接上代码,有兴趣的加QQ群(687039778)讨论,验证问题:太极创客网址答案: http://www.taichi-maker.com/void setup() {
asm("SBI 0x04, 0x05");//设置13Pin为输出模式
asm("CBI 0x05, 0x05");//设置13Pin为低电平
asm("OUTPUT:");
asm("INR16, 0x05"); //读取13Pin电平存入R16寄存器
asm("LDI R17, 0x20"); //设置R17寄存器为0x20
asm("EOR R16,R17"); //将R16与R17的值异或运算,结果存入R16
asm("OUT 0x05, R16"); //设置13Pin的电平
asm("LDI R19, 0xAE"); //延时设置
asm("DELAY0: LDI R16, 0x03");
asm("DELAY1: LDI R18, 0x00");
asm("DELAY2: INC R18");
asm("BRNE DELAY2");
asm("INC R16");
asm("BRNE DELAY1");
asm("INC R19");
asm("BRNE DELAY0");
asm("RJMP OUTPUT"); //跳转至 OUTPUT
}
void loop() {}
页:
[1]