微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > 用PIC低档单片机模拟串口通讯.

用PIC低档单片机模拟串口通讯.

时间:11-19 来源:互联网 点击:

movlw D14 ;
movwf temp2 ;
movlw 0 ; 0-1,will be overflow to 255.
movwf temp ; (774+3)*14~=11ms
lp1 ; delay about 11ms?
call UART_delay ; 256*3+6=774 clock.
decfsz temp2,f ;
goto lp1 ;
retlw 0
;*
delay
clrf TIMER0
d1s MOVLW D255 ;
SUBWF TIMER0,w ;TIMER0
BTFSS STATUS,Z ;
GOTO d1s
retlw 0
;main loop
;
;
;
main
call delay
btfss GPIO,Fw
goto fwd
nop
nop
btfss GPIO,Rw
goto rev
nop
nop
btfss GPIO,Vd
goto vdo
nop
nop
btfss GPIO,Vp
goto vpl
nop
nop
btfss GPIO,Pa
goto pypa
nop
goto main

fwd
movlw 010H
movwf Txipod1
movlw 0EBH
movwf Txipod2
call ipod_packet
btfss GPIO,Fw
goto fwd
goto rel ;goto release....
rev
movlw 08H
movwf Txipod1
movlw 0F3H
movwf Txipod2
call ipod_packet
btfss GPIO,Rw
goto rev
goto rel ;goto release....
vdo
movlw 04H
movwf Txipod1
movlw 0F7H
movwf Txipod2
call ipod_packet
btfss GPIO,Vd
goto vdo
goto rel ;goto release....
vpl
movlw 02H
movwf Txipod1
movlw 0E9H
movwf Txipod2
call ipod_packet
btfss GPIO,Vp
goto vpl
goto rel ;goto release....
pypa
movlw 01H
movwf Txipod1
movlw 0FAH
movwf Txipod2
call ipod_packet
btfss GPIO,Pa
goto pypa
goto rel ;goto release....
rel
movlw 0
movwf Txipod1
movlw 0FBH
movwf Txipod2
call ipod_packet
goto main

end

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top