The leader in industrial automation and control solutions

Applicable Model(s)

OIT Models

Title

Thumbwheel Switch Replacement using Maple Systems OITs

Date

10/23/2023

Rev

00

P/N

0907-1065

Frequently, thumbwheel switches are used to transfer numeric data to a Control System. A Maple Systems OIT configured with STEPware can replace one or more thumbwheel switches. This document presents some sample BASIC code that can be used to get data from an OIT, and make it available to the control system.

Not all controllers will support the commands, syntax, and structure listed below. The Engineer will need to determine if the code will work as listed; or what modifications are necessary.

NOTE: In BASIC, a PRINT statement normally appends a Carriage Return after a the data in the statement is printed. In the code below, some PRINT statements are followed by a
semicolon (;). This causes the PRINT statement to NOT add a Carriage Return to the
printed data. It is common in BASIC for the semicolon to have this functionality;
however, it may not be supported in special versions of BASIC used in some controllers.


As with thumbwheel switches, the Controller must be told to get the data. The following code assumes that some input has been activated (or other event), which instructs the Controller to look for data.


‘ set the cursor position to 1,1

‘ and display the current value (note the semicolon)


100 PRINT CHR(27);”x11″;CHR(2);


‘ VALUE contains the value to be modified


110 PRINT “Current Value: ”;STR(VALUE)


‘ set the cursor position to 1,2 and ask for the new value


‘ (note the semicolon)


120 PRINT CHR(27);”x12″;CHR(2);


130 PRINT “Enter New Value ”;


140 INPUT NEWDATA$


‘ the data from the OIT comes in as a String;


‘ so convert it to a number


150 NEWVAL = VAL(NEWDATA$)


‘ save the new value


‘ and proceed with the rest of the program


160 VALUE = NEWVAL


‘ rest of program follows

If the controller supports it, this code could be implemented as a Subroutine. After the subroutine returns, set the variable being changed to VALUE.