参数资料
型号: DM164120-1
厂商: Microchip Technology
文件页数: 30/42页
文件大小: 0K
描述: BOARD DEMO PICKIT 2 LP COUNT
标准包装: 1
系列: PICkit™
类型: MCU
适用于相关产品: 28 引脚 PIC16C、16F、18C、18F
所含物品: 3 个板(1 个装有元件的板,2 个裸板)
产品目录页面: 659 (CN2011-ZH PDF)
Low Pin Count Demo Board User’s Guide
3.2.8
Lesson 8: Function Calls
Lesson 8 shows the reversible LEDs but with the Delay Loop rewritten as a function.
New Instructions
CALL
RETURN
RETLW
Invokes functions or subroutines
Terminates functions or subroutines
Terminates functions or subroutines
Functions or Subroutines are invoked with the CALL instruction and terminated with a
RETURN or RETLW instruction. RETURN jumps back to the original program at the
location following the CALL . RETLW also returns to the calling program, but loads Wreg
with a constant.
The mid-range PICmicro MCU device’s CALL stack can hold up to 8 return addresses.
If a ninth CALL is made, it will overwrite the first one and then the program will not be
able to RETURN all the way back.
Passing Arguments
Arguments to the subroutine may be passed in a number of ways. Wreg is a convenient
place to pass one byte and the FSR may be used to pass another byte, if not otherwise
used. If more data must be passed, a buffer must be allocated.
When the Delay function is pulled out to a subroutine, the ADC result is moved into
Wreg, then the CALL transfers control to the Delay subroutine. The RETURN transfers
control to the MOVLW following the CALL .
EXAMPLE 3-7:
MOVF
FUNCTION CALL EXAMPLE
ADRESH,w
CALL
Delay
;call delay function
;returns here when done
...
GOTO
xxx
; Delay function.
; Delay time is Wreg value * 771 uS
Delay
MOVWF Delay2
DelayLoop
DECFSZ Delay1,f
GOTO DelayLoop
DECFSZ Delay2,f
GOTO DelayLoop
RETURN
DS51556A-page 26
? 2005 Microchip Technology Inc.
相关PDF资料
PDF描述
DM164120-3 BOARD DEMO PICKIT2 28-PIN
DM164120-5 BOARD DEMO PICKIT 2 64/80-PIN
DM164123 KIT MANAGEMENT SYSTEM PICDEM
DM180021 KIT STARTER MPLAB FOR PIC18F MCU
DM183022 BOARD DEMO PIC18FXX22 64/80TQFP
相关代理商/技术参数
参数描述
DM164120-1 制造商:Microchip Technology Inc 功能描述:DEVELOPMENT TOOLS - PICKIT 2 LOW PIN COU
DM164120-2 功能描述:开发板和工具包 - PIC / DSPIC PICkit 2 44-Pin Count Demo Brd RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM164120-3 功能描述:开发板和工具包 - PIC / DSPIC PICkit 2 Count Demo Board RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM164120-4 功能描述:开发板和工具包 - PIC / DSPIC PICkit 2 1 Dem Board RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM164120-4 制造商:Microchip Technology Inc 功能描述:PICkit 2 18-Pin Demo Board