Shop OBEX P1 Docs P2 Docs Learn Events
Process Control Quick Question on Code — Parallax Forums

Process Control Quick Question on Code

grlsoccer1grlsoccer1 Posts: 2
edited 2012-03-02 13:30 in BASIC Stamp
Code given:
' -----[ 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

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2012-03-02 09:54
    This code isn't asking you to label the text boxes...it is sending the label data after that comment. The comment is in the code to tell you what that section of code is doing.
  • grlsoccer1grlsoccer1 Posts: 2
    edited 2012-03-02 13:30
    Yeah, I kind of figured that out after taking a long break but thanks for the reply. The reason was that I wasn't getting anything in stamp plot but figured that I had to press the reset button after connecting so it can start reading.
Sign In or Register to comment.