DM164120-2 Microchip Technology, DM164120-2 Datasheet - Page 30

BOARD DEMO PICKIT 2 44PIN

DM164120-2

Manufacturer Part Number
DM164120-2
Description
BOARD DEMO PICKIT 2 44PIN
Manufacturer
Microchip Technology
Type
MCUr
Datasheets

Specifications of DM164120-2

Contents
3 Boards (1 Populated, 2 Bare)
Processor To Be Evaluated
PIC16F
Silicon Manufacturer
Microchip
Kit Contents
PIC16F Device, 2 PCB Boards
Features
Small Surface Mount Prototype Area, Two Bare PCB Boards
Development Tool Type
Hardware - Daughter Card
Rohs Compliant
Yes
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
PIC16F887
Lead Free Status / Rohs Status
Lead free / RoHS Compliant

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
DM164120-2
Manufacturer:
Microchip Technology
Quantity:
135
44-Pin Demo Board User’s Guide
DS41296B-page 26
3.2.8
Lesson 8 shows the reversible LEDs but with the Delay Loop rewritten as a function.
New Instructions
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 the
WREG with a constant.
The mid-range PIC
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 conve-
nient place to pass one byte and the FSR may be used to pass another byte, if not oth-
erwise 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 trans-
fers control to the MOVLW following the CALL.
EXAMPLE 3-7:
3.2.9
Timer0 is a counter implemented in the processor. It may be used to count processor
clock cycles or external events. Lesson 9 configures it to count instruction cycles and
set a flag when it rolls over. This frees up the processor to do meaningful work rather
than just counting cycles for a delay.
Timer0 is an 8-bit counter with an optional prescaler, which is configured to divide by
256 before reaching the Timer0 counter.
...
; Delay Function.
Delay:
DelayLoop:
CALL
RETURN
RETLW
MOVF
ADDLW
CALL
GOTO
MOVWF
DECFSZ
GOTO
DECFSZ
GOTO
RETURN
Lesson 8: Function Calls
Lesson 9: Timer0
ADRESH,w
1
Delay
XXX
Delay2
Delay1,f
DelayLoop
Delay2,f
DelayLoop
; goes back to instruction after call
®
FUNCTION CALL EXAMPLE
microcontroller device’s CALL stack can hold up to 8 return
Invokes functions or subroutines
Terminates functions or subroutines
Terminates functions or subroutines
Enter with number of 771uS delays in Wreg
; Move conversion value (delay) to w
; add 1 otherwise entering with 0 takes
; longer than entering with 1.
; Call delay function
; returns here when done
© 2007 Microchip Technology Inc.

Related parts for DM164120-2