QUESTION 2 The BASIC Stamp program shown below will operate the Boe-Bot in a str
ID: 3770573 • Letter: Q
Question
QUESTION 2
The BASIC Stamp program shown below will operate the Boe-Bot in a straight line. For how many seconds will the robot operate? Recall that for each FOR-NEXT loop, the pulse to P13 is 1.7 ms, the pulse to P12 is 1.3 ms, the pause duration is 20 ms, and the software overhead is 1.6 ms.
'{$STAMP BS2}
'{$PBASIC 2.5}
DEBUG "Program Running!"
counter VAR Word
FOR counter = 1 TO 250
PULSOUT 13, 850 ' P13 servo counterclockwise
PULSOUT 12, 650 ' P12 servo clockwise
PAUSE 20
NEXT
END
Explanation / Answer
FOR counter = 1 TO 250
Time consumed in one counter ::
P13 -> 1.7ms * 850 = 1445 ms
P12 -> 1.3ms * 650 = 845 ms
Pause -> 20 ms
1445 + 845 + 20 = 2310 ms
Time consumed in 250 counter = 250 * 2310 ms = 577,500 ms ~ 577.5 s
The Software Overhead (= 1.6ms) can be ignored, because it is very very small compared to the total time.