AVR单片机:串口通讯有错吗?
我用8515编了一个简单的通讯程序,可串口没有数据输出,不知到是设置不对,还是什么
毛病,望大家给点意见!并能够修改!我先谢过!
.device at90s8515
.def temp=r16
.def zh=r31
.def zl=r30
;.equ udr=$0c
;.equ usr=$0b
.equ label=$0200
.equ durie=5
.org $0000
rjmp reset
;.cseg
.org 0x0010
;reset at90s8515
reset:
; ldi temp,0b00001000 ;aini at enable
;out $17,temp
ldi temp,$02 ;stack
out $3e,temp
ldi temp,$02
out $3d,temp
ldi temp,$ff
out $11,temp
ldi temp,51 ;baud 19200bps at 11.0592M fosc
out $09,temp
ldi temp,$08 ;enable rx and tx
out $0a,temp
;sei
rjmp main
main:
cbi $12,4
sbi $12,5
clr r19
ldi r22,$80
start:
ldi r21,$08
;ldi zh,high(label*2)
coloum:
ldi r20,$04
next:
; mov temp,r19
; inc r19
;rcall get_code
ldi temp,$aa
out $0c,temp
wait2:
sbis $0b,5
rjmp wait2
dec r20 ;send data to 115200bps uart
brne next
out $0c,r22
wait3:
sbis $0b,5
rjmp wait3
lsr r22
sbi $12,4
rcall delay
rcall delay
rcall delay
rcall delay
rcall delay
rcall delay
cbi $12,4
dec r21
brne coloum
rjmp main
get_code:
; ldi zl,low(label*2)
; add zl,temp
; lpm
; mov temp,r0
ldi temp,$aa
ret
delay:
ldi r24,$ff
delay1:
dec r24
brne delay1
ret
发表时间:2003年2月24日15:34:00