Software Delays:: Delayreg. Next, We Need To Decide How Big A Number To Start Counting From

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

7/7/2015

SoftwareDelays

SoftwareDelays:
Theprincipleofthesoftwaredelayisthatwecountdownfromapreviouslysetnumber,andwhenit
reacheszero,westopcounting.Thezerovalueindicatestheendofthedelay,andwecontinueonwith
theprogram.
So,thefirstthingweneedtodoistodefineaconstanttouseinthecounter.Wewillcallthisconstant
Delayreg.Next,weneedtodecidehowbiganumbertostartcountingfrom.

Example:
Q1.Developaflowchartandwriteanassemblylanguagesubroutine,forthePIC16F84microcontroller,
http://www.electronics.dit.ie/staff/tscarff/Delays/software_delays.htm

1/2

7/7/2015

SoftwareDelays

thatwillproduceadelayof150s.Assumethattheinternalclockcycletimeis1s.

ForthePIC16F84microcontrollerinstructionsetthenumberofcyclesare:
Cycles=150at1s

Delaymovlw.491
movwfdelayreg1
Loopdecfszdelayreg1/2
gotoLoop2
Return2

Totalnumberofcyclesis:
T=1+1+[(N1)x3)]+2+2=150cycles,whereN=numberofloops
SoforN=49thenT=150cycles
Soforaninternalclockcycletimeof1usthedelayis150s.

http://www.electronics.dit.ie/staff/tscarff/Delays/software_delays.htm

2/2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy