Campbell Scientific CR9000X Measurement and Control System User Manual
Page 392

Section 10. Custom Keyboard Display Menus
The MenuItem instruction creates an item that displays the value of a variable
and allows the value to be edited. The MenuItem can be set up to be edited
either by keying in a new numeric value or by selecting an option from a pick
list.
MenuPick is use to create a pick list for MenuItem. A link to another user
menu can be created with the SubMenu and EndSubMenu functions.
Example Program 10-1 is an example of a CRBasic program to set-up a custom
display. It is used as a model for the instructions in this section.
Example Program 10-1:
'Declare Variables for panel temperature, two thermocouples, a [down] counter
‘and a flag to determine if the count is active or not:
Public Tpnl, Ttc(2)
Public Counter, CountFlag
'Declare constants for menu display:
Const Yes = True
Const No = False
DataTable (Temp,1,1000)
'Define DataTable Temp:
DataInterval
(0,1,Sec,10)
Average
(1,Tpnl,IEEE4,0)
Average
(2,Ttc(),IEEE4,0)
EndTable
DisplayMenu ("Example Custom Menu",1)
'Define Custom Menu:
SubMenu("Current
Temperatures")
DisplayValue("Panel
Temp",Tpnl)
DisplayValue("TC
1",Ttc(1))
DisplayValue("TC
2",Ttc(2))
EndSubMenu
SubMenu("Last 1 Min. Averages")
DisplayValue("Panel
Temp",Temp.Tpnl_Avg(1,1))
DisplayValue("TC 1",Temp.Ttc_Avg(1,1))
DisplayValue("TC 2",Temp.Ttc_Avg(2,1))
EndSubMenu
SubMenu ("Play with Down Count")
MenuItem
("Enable",CountFlag)
MenuPick
(Yes,No)
'Create a pick list with constants
MenuItem("Down
Count",Counter)
MenuPick(15,30,45,60)
'Create a pick list for Counter
'While the counter can be reloaded with the above menu item,
'using a sub menu allows slightly more descriptive text:
SubMenu("Reload
Down
Counter")
MenuItem("Pick
Count",Counter)
MenuPick(15,30,45,60)
'Create a pick list for Counter
MenuItem("Enter
No.",Counter)
'no pick list = user enters #
EndSubMenu
EndSubMenu
EndMenu
BeginProg
'Main Program
Scan
(10,mSec,100,0)
ModuleTemp
(Tpnl,1,1,100)
TCDiff
(Ttc(),2,mV50C,4,1,TypeT,Tpnl,True ,40,100,1.0,0)
If
CountFlag
Then
Counter=Counter-1
If
Counter
<=0
Then
Counter=0
EndIf
CallTable
Temp
NextScan
EndProg
10-2