'{$STAMP BS2} 'StampPlot General Use interface example 'Once the macro is running, connect on StampPlot 'If the configuration does not change, you may need to reset your Stamp 'If the STamp appears to lock up, you may need to disable DTR (configuration) X VAR Byte PAUSE 500 '************ Configure StampPlot ' Configure Gauges DEBUG "!POBJ GA1=,-200,200,-150,150",CR 'set gauge range and setpoints DEBUG "!POBJ GA1.C=~PWAV gbell.wav",CR 'set gauge event code to play bell DEBUG "!POBJ GA1.U=(AINVAL0)",CR 'set update value for gauge 1 to analog value 0 DEBUG "!POBJ GA1L.U=(AINVAL0)",CR 'set gauge 1 label to analog value 1 ' Configure Gauges DEBUG "!POBJ SLD1=,-200,200",CR 'Set ranges of slider 1 DEBUG "!POBJ SLD1.C=!POBJ GA1=,,,-500,(SLD1)",CR 'When moved, use slider value to set high setpoint of gauge DEBUG "!POBJ SLD1L=Setpoint",CR 'Set the label for the slider ' Configure points and progress bar DEBUG "!PNTS 500",CR 'Set total number of points: DEBUG "!POBJ BAR1=,500",CR 'set maximum of bar1 to 500 DEBUG "!POBJ BAR1.U=(DPOINT)",CR 'Set update value of bar 1 to number of points collected DEBUG "!POBJ BAR1L=Data Points",CR 'Set label for Bar 1 'Configure switches DEBUG "!POBJ SW*.C=~IWAV Stapler.wav",CR 'Set sound for switches using wildcard 'Configure text boxes DEBUG "!POBJ TXT1.U=MAX: (AINMAX0)",CR 'Set update value for TXT1 -3 for max, min and average DEBUG "!POBJ TXT2.U=MIN: (AINMIN0)",CR DEBUG "!POBJ TXT3.U=AVE:(AINAVE0)",CR 'Configure buttons for resetting DEBUG "!POBJ BUT1=RESET",CR 'set buttons 1 for reset operation DEBUG "!POBJ BUT1.C=!RSET",CR DEBUG "!POBJ BUT2=Clear Min/Max",CR 'Set button 2 for clearing min/max DEBUG "!POBJ BUT2.C=!CLMM",CR ' Configure checkboxes DEBUG "!POBJ CHK1.Tip=Real Time",CR 'Set checkbox tip and code for showing real time DEBUG "!POBJ CHK1.C=!RTIM ((ME))",CR ' Configure banner DEBUG "!POBJ BAN.U= ******** StampPlot (PRDT) ********* ,(BLACK),(GREEN)",CR 'set banner ' Configure buttons for list control DEBUG "!POBJ BUT3=Add to list",CR 'set button 3 to add min/max/ave to list DEBUG "!POBJ BUT3.C=!POBJ LST=(RTIME) (TXT1) (TXT2) (TXT3)",CR DEBUG "!POBJ BUT4=Clear List",CR 'set button 4 to clear list box DEBUG "!POBJ BUT4.C=!POBJ LST.Clear",CR ' size listbox DEBUG "!POBJ LST.M=,,,10",CR 'move listbox to height of 8 ' Configure check 2 to hide switches DEBUG "!POBJ CHK2.C=!POBJ SW*.V=((ME))",CR 'set check box 2 to make switches visible or not ' Add a new text box DEBUG "!POBJ oText.TXT5=8,8",CR 'cerate a new text box DEBUG "!POBJ TXT5.U=(AMAX)",CR 'update text 5 with analog scale maximum DEBUG "!PLOT ON",CR 'Enable plotting DEBUG "!RSET",CR 'Reset plot ' ******************************** DIRC = %1111 'Set nibble C as outputs Loop: FOR X = 0 to 255 DEBUG "!READ (SW4)(SW3)(SW2)(SW1)",CR 'Request data of SW1 SERIN 16,85,500,TimeOut,[BIN OUTC] 'Accept returning data from StampPlot to OUTC with Timeout TIMEOUT: PAUSE 100 'Pause to allow echo to clear on programming port (P16) DEBUG IBIN4 OUTC,CR 'Plot OUTC as binary value DEBUG DEC X, ",(SLD1)",CR 'plot value with setpoint of slider DEBUG "!POBJ Update",CR 'update all objects with their update values DEBUG "!MACR .SET_LTS,", DEC OUTC,CR 'Call macro routine and pass OUTC in decimal PAUSE 100 NEXT GOTO Loop