📄 init_uart2.s
字号:
;START_HEADER
;
; dsPIC30F6014 Demo Source File
; (c) Copyright 2005 Microchip Technology, All rights reserved
;
; --------------------------------------------------------------------------
; File Revision History:
; --------------------------------------------------------------------------
;
; $Log: init_uart2.s,v $
; Revision 1.3 2005/04/04 23:44:13 VasukiH
; Updates to comments in file header
;
; Revision 1.2 2005/04/04 23:15:45 VasukiH
; Updates for MPLAB C30 v1.30 compatiblity
;
; Revision 1.1.1.1 2003/08/23 00:38:32 VasukiH
; First import of demo source into CVS Repository
;
;
;
; --------------------------------------------------------------------------
;
; Software and Development Tools Info:
; --------------------------------------------------------------------------
; Tool Version
; --------------------------------------------------------------------------
; MPLAB IDE 7.0
; MPLAB C30 Toolsuite 1.30
; dsPICDEM(TM) Processor Board 1.10
; --------------------------------------------------------------------------
;
; File Notes:
; 1. Sets up UART2 to receive and transmit at 57600 baud
; 2. UART2 Txmit is used to refresh a data display on the Host PC
; HyperTerminal session window.
; 3. UART2 Rcv is used to accept numeric entries from a PC Keyboard. The input
; is used to generate DTMF tones output to the codec, via the DCI module.
;
;END_HEADER
.include "p30fxxxx.inc"
.section .text
.global _init_uart2
_init_uart2:
;Initialize and Enable UART1 for Tx and Rx
clr U2MODE ;Set SFRs to a known state
clr U2STA
bclr U2STA, #URXISEL1
bclr U2STA, #URXISEL0
bclr IFS1, #U2RXIF
bset IEC1, #U2RXIE ;Enable Rx ISR processing
bset U2MODE, #UARTEN ;Enable UART
mov #(((7372800/57600) / 16) - 1), W0 ;Initialize Baud rate
mov w0, U2BRG ;to 57.6 Kbaud
bclr IFS1, #U2TXIF ;Enable Txmit ISR processing
bset IEC1, #U2TXIE
bset U2STA, #UTXISEL
bset U2STA, #UTXEN ;Enable Transmission
return
.end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -