AVR I/O简单汇编计数程序问题
编译一个简单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
.defcount =r16 ;Reg 16 will hold counter value
.deftemp=r17 ;Reg 17 is used as a temporary register
.equPORTB =0x18 ;Port B's output register
.equDDRB=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)
你重复定义了PORTB和DDRB
把
.equPORTB =0x18 ;Port B's output register
.equDDRB=0x17 ;Port B's Data Direction Register
屏蔽掉看看 waothom 发表于 2014-3-1 15:38
你重复定义了PORTB和DDRB
把
.equPORTB =0x18 ;Port B's output register
这位兄台说的对,屏蔽后ok,看样子在AVR Studio6 已经定义好了~谢谢!
页:
[1]