Chapter 6. USART Demo – PIC17C42
btfss
call
goto
TEMP,1
Xmit
Loop
; check for key press
; send next value
; check again
;
;
Init_ports
movlb 0 ; select bank 0
clrf DDRB, F ; port b all ouptuts
clrf PORTB, F ; and all low.
return
;
; This routine initailizes the serial port. Baud rate, receive interrupt
; software flags are initailized.
;
Init_serial
movlb 0 ; select bank 0
movlw .25 ; select 9600 baud
movfp WREG,SPBRG ; /
movlw 0x90 ; set up serial pins
movfp WREG,RCSTA ; /
clrf TXSTA, F ; setup transmit status
movlb 1 ; select bank 1
clrf PIR, F ; clear all interrupts
clrf PIE, F ; clear all enables
bsf _rcie ; enable receive interrupt
movlb 0 ; select bank 0
bsf _txen ; enable transmit
bsf _peie ; enable peripheral ints
retfie
;
; This routine handles all the peripheral interrupts. In this example
; only the receive interrupt is handled.
; check for receive interrupts only
;
Service_perf
bcf _peie ; disable perf int
movlb 1 ; bank 1
btfsc _rbfl ; RX buffer full?
call Service_recv ; yes then service
Exit_perf
bsf _peie ; enable peripheral int
retfie
;
; This routine services the serially received info.
Service_recv
movlb
0
movfp
movwf
RCREG,WREG
PORTB
; load received value
? 1999 Microchip Technology Inc.
DS33015C-page 43
相关PDF资料
DM163004-LT BOARD DEMO PICDEM.NET
DM163005 KIT EVAL PIC16C432/433 LIN BUSS
DM163007 PICDEM CAN-LIN 1 FOR 18C658/858
DM163008 KIT MCP2120/2150 FOR IRDA COMM
DM163010 BOARD DEMO PICDEM USB
DM163012 BOARD DEMO PICDEM FOR 16C781/782
DM163024 BOARD DEMO PICDEM.NET 2
DM163025 PIC DEM FULL SPEED USB DEMO BRD
相关代理商/技术参数
DM163002 制造商:Microchip Technology Inc 功能描述:PIC16C64/74 DEMO BOARD
DM163003 功能描述:开发板和工具包 - PIC / DSPIC PICDEM 3 PIC16C923/4 RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM163004 功能描述:开发板和工具包 - PIC / DSPIC USE 579-DM163004-LT RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM163004 制造商:Microchip Technology Inc 功能描述:DEMO BOARD W/TCP/IP ((NW))
DM163004-LT 功能描述:开发板和工具包 - PIC / DSPIC PICDEM.net Demo Kit w/o TCP/IP Lean Book RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM163005 功能描述:开发板和工具包 - PIC / DSPIC PICDEM PIC16C432/3 RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM163006 功能描述:开发板和工具包 - PIC / DSPIC 18R PIC18C601/801 RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM163007 功能描述:开发板和工具包 - PIC / DSPIC For PIC18C658/858 RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压: