122-28176 Parallax Inc, 122-28176 Datasheet - Page 116

GUIDE STUDENT PROCESS CONTROL

122-28176

Manufacturer Part Number
122-28176
Description
GUIDE STUDENT PROCESS CONTROL
Manufacturer
Parallax Inc
Datasheets

Specifications of 122-28176

Accessory Type
Manual
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
Propeller Education (PE) Kit
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
Consider the partial flowchart in Figure 4-15 (b). As long as a box is not detected, the
decision will be false and no count will occur. When a sample detects a box, the flow
will loop and wait until the box is no longer detected (waiting for the transition) before
counting. Do you see any problems in the algorithm? Once the flow enters the waiting
loop, no other actions can take place, such as sensing if the STOP button is pressed in the
event of an emergency. If someone's sleeve gets caught, they may have lost a limb
during the time it takes the box to pass! The batch mix program in Activity 4-2 used
subroutine calls in order to continually plot data. The call could also be used to check the
status of the stop button. However, if our program has many routines that need to be
continuously performed, that may not be the best solution.
Through the use of a flag a much more elegant and efficient means is demonstrated in
Figure 4-15 (c). A flag is simply used to indicate a condition. One example is raising the
flag on a mailbox to indicate a need to pick-up outgoing mail. In programming, a flag is
typically a bit variable, set HIGH to indicate the occurrence of a condition.
In Figure 4-15 (c):
In the following code, a nested
box passing and then the flag to see if a count needs to occur:
Once a box is detected (TRUE), the flag is set.
When the box has passed and is not present (FALSE), the flag will be checked.
If the flag is set, it indicates that a box HAD been present, so the program will
add one as passing. - Don't forget to reset the flag for the next box!
When the box is not present and the flag is not set, program execution will
continue without counting a box. This allows the remaining code in the program
to continue execution by flagging an event instead of waiting for an event.
IF (Opto_Sw = 1) THEN
ENDIF
Certain processors, such as the BS2p, have polling and/or interrupt capabilities to branch
automatically to a location based on conditions, but the BS2 does not.
IF (Edge_Flag = 1) THEN
ENDIF
Box_Count = Box_Count + 1
Edge_Flag = 0
IF...THEN
could be used to check the condition of the
' True if no box
' True if Flag set

Related parts for 122-28176