Chapter 3. Tutorials
3.2
Source Code – PIC16C54
The tutorial program listed below is for the PIC16C54 device. It can be
modified for all other supported devices. See files titled tut??.asm , where
?? represents the last two numbers of a device.
list p=16c54
;
;
;
;
;
;
;
;
;
This program runs on the PICDEM-1 demo board.
In the Demo board, Port B is connected to 8 LEDs.
RA1 is connected to a switch (S3). This program increments
the file register count each time S3 is pressed.
The value of count is displayed on the LEDs connected
to Port B.
Net result is that Leds should increment in a binary
manner every time S3 is pressed.
;
#include <P16C5X.INC>
;
COUNT
;
Start
equ
org
movlw
00h
0
0x10
movwf
tris
clrf
Loop
btfss
goto
Endloop
goto
IncCount
incf
movf
movwf
Debounce
btfss
goto
Enddebounce
goto
;
;
org
goto
;
end
PORTB
PORTB
COUNT
PORTA,1
IncCount
Loop
COUNT,F
COUNT,W
PORTB
PORTA,1
Debounce
Loop
0x01FF
Start
; config port b as output
; clr count
; see if RA1 pressed
; yes then inc count
; else check again
;inc count
;
; display on port b
; wait for key release
; not release then wait
; else check key press again
; 16C54 reset vector.
? 1999 Microchip Technology Inc.
DS33015C-page 13
相关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 接口类型: 工作电源电压: