27297 Parallax Inc, 27297 Datasheet - Page 26

KIT STAMPWORKS WITH BS2-IC

27297

Manufacturer Part Number
27297
Description
KIT STAMPWORKS WITH BS2-IC
Manufacturer
Parallax Inc
Datasheet

Specifications of 27297

Lead Free Status
Contains lead
Product
Microcontroller Accessories
Lead Free Status / Rohs Status
Lead free / RoHS Compliant

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
27297SQ
Manufacturer:
NS
Quantity:
4
The STEP option of FOR-NEXT is used when the loop needs to count in increments
other than one. If, for example, the loop needed to count even numbers, the code
would look something like this:
SUBROUTINES – REUSABLE CODE THAT SAVES PROGRAM SPACE
The final programming concept we’ll discuss is the subroutine. A subroutine is a
section of code that can be called from anywhere in the program. GOSUB is used to
redirect the program to the subroutine code. The subroutine is terminated with the
RETURN instruction. RETURN causes the program to jump back to the line of code
that follows the calling GOSUB.
In this example, the code in the My_Sub subroutine is executed and then the
program jumps back to the line PAUSE 1000.
Advanced programmers will take advantage of subroutines and the ON-GOSUB
instruction. ON-GOSUB works like ON-GOTO, except that the program returns to the
line that follows ON-GOSUB. This technique is very useful for creating
program structures as shown next:
FOR counter = 2 TO 20 STEP 2
NEXT
Start:
My_Sub:
Main:
statement 1
statement 2
statement 3
DO
LOOP
statement 1
statement 2
statement 3
RETURN
DO
LOOP
GOSUB My_Sub
PAUSE 1000
GOSUB Critical_Task
ON task GOSUB Task_1, Task_2, Task_3
task = task + 1 // 3
task manager

Related parts for 27297