|
编译一个简单AVR汇编,在AVR STUDIO 6编译出错:WHY?
编译出错信息:
invalid redefinition of "PORTB"
invalid redefinition of "DDRB"
程序如下:
;Illustrate_PORT_Output_and_Counting.asm
;Counter - A simple AVR program to illustrate output to a port
;Designed to be executed in a simulator under debug control
;This program counts from 0 to 255 (and repeats)
;The current counter value is output to PORTB of an ATmega16A
;Progarmmer: TM
;Date: 2/2014
;Platform: STK-500
;Device: ATmega16A
.cseg ;select current segment as code
.org 0 ;begain assembling at address 0
;Define symbolic names for resources used
.def count =r16 ;Reg 16 will hold counter value
.def temp =r17 ;Reg 17 is used as a temporary register
.equ PORTB =0x18 ;Port B's output register
.equ DDRB =0x17 ;Port B's Data Direction Register
ldi temp, 0xFF ;configure PORTB as ouput
out DDRB, temp
ldi count, 0x00 ;Initialize count at 0
lp:
out PORTB, count ;Put counter value on PORT B
inc count ;increment counter
rjmp lp ;repeat (forever)
|
阿莫论坛20周年了!感谢大家的支持与爱护!!
知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)
|