PDA

View Full Version : Newbee pause from var word



emmett brown
- 6th August 2006, 22:31
In my code there is ten or so pause's that need to be changed from time to time. How do I have the pause command look at a fixed value so that I only have to change it, instead of ten lines of code? What am I missing?

I might have figured it out, after an hour of searching, sometimes it just don't soak in

T1 var word
PAUSE T1
T1=600

Thanks to the greatest forum ever! Emmett

Melanie
- 7th August 2006, 00:38
You've got it... except in your example you should set T1 to have a value BEFORE your first usage of PAUSE.

Here's an example that will vary the length of time an LED will stay ON...

MyDelay var WORD
LED var PortB.0
TRISB=0

Loop:
For MyDelay=1000 to 10000 step 1000
High LED
Pause MyDelay
Low LED
Pause 1000
Next MyDelay
Goto Loop

emmett brown
- 9th August 2006, 00:20
Ah Makes sense I love PBP and this forum! Priceless! Thanks much Melanie!