Process Control Quick Question on Code
Code given:
What does it mean, label text boxes? Do I have to put a name? I've been trying to get a reading of a RPM but haven't and I don't if its because of that?
' -----[ Declarations ]----------------------------------------------------
Opto_SW PIN 8 ' Opto-Reflector
Sampled PIN 9 ' Indicator to indicate sampling
Opto_Count VAR Word ' Count from opto-reflective switch
RPM VAR Word ' Calculated RPM
SP_Data VAR Word ' Data returned from StampPlot
CyclesPerRev CON 1
' -----[ Initialization ]--------------------------------------------------
PAUSE 500 ' Connection stabilizing time
DEBUG CR,"!RSET",CR, ' Reset StampPlot
"!CLRC",CR, ' Clear any text on plot
"!SPAN 0,10000",CR ' Set Y-Axis span
' Label text boxes '<<---- ???
DEBUG "!O lblData = Sample Time\n (mSec)", CR,
"!O txtData = 1000", CR,
"!O txtR = ", CR,
"!O txtY = ", CR,
"!O txtG = Sampled", CR,
"!O Stat1 = Counts:", CR,
"!O Stat2 = RPM:", CR,
"!O txtFileName = Tach1", CR
DEBUG "!O Meter = 0,0,10000,0,10000", CR ' Set SP meter
DEBUG "!RSET", CR ' Reset after configuring
LOW Sampled
' -----[ Main Routine ]----------------------------------------------------
DO
GOSUB ReadSP
GOSUB ReadTach
GOSUB DisplayData
LOOP
ReadSP:
DEBUG "!READ (txtData)",CR ' Request data from StampPlot
DEBUGIN DEC SP_Data ' Accept returning DATA
RETURN
ReadTach:
COUNT Opto_SW,SP_Data,Opto_Count ' Measure counts per unit time
TOGGLE Sampled ' Toggle LED to show sample done
RPM = Opto_Count * (60000 / SP_Data) / CyclesPerRev ' Calculate RPM
RETURN
DisplayData:
DEBUG DEC RPM,CR ' Analog data of RPM
DEBUG IBIN Sampled, CR ' Digital trace of samples
DEBUG "!O Stat1 = Counts: ", DEC Opto_Count, CR ' Update controls
DEBUG "!O Stat2 = RPM: ", DEC RPM, CR
DEBUG "!O METER =", DEC RPM, CR ' Update SP Meter
DEBUG "!O ImgG = ", BIN Sampled, CR
RETURN
What does it mean, label text boxes? Do I have to put a name? I've been trying to get a reading of a RPM but haven't and I don't if its because of that?

Comments