Software
Crestron
SIMPL+
}
myStruct struct;
PUSH writeCompactFlashCard
{
SIGNED_INTEGER nFileHandle;
INTEGER nNumBytes;
StartFileOperations()
nFileHandle = FileOpen( "\\CF0\\MyFile.txt",
_O_WRONLY | _O_CREAT );
if( nFileHandle >= 0 )
{
WriteStructure( nFileHandle, struct, nNumBytes );
Print( “The number of bytes written = %d”, nNumBytes );
FileClose( nFileHandle );
}
EndFileOperations();
}
PUSH readCompactFlashCard
{
SIGNED_INTEGER nFileHandle;
INTEGER nNumBytes;
StartFileOperations()
nFileHandle = FileOpen( "\\CF0\\MyFile.txt", _O_CREAT );
if( nFileHandle >= 0 )
{
ReadStructure( nFileHandle, myInt, nNumBytes );
Print( “The number of bytes read = %d”, nNumBytes );
FileClose( nFileHandle );
}
EndFileOperations();
}
Working with Time
Up until now, this manual has discussed elements of the SIMPL+ language that have
no concept of time. This means that each statement in a SIMPL+ program executes
after the previous statement is completed. There are times when programming where
there is a need to have control over exactly when the statements in the program
execute. This section deals with those language constructs.
Delay
The
Delay
function pauses the execution of the current SIMPL+ for the time
specified in the parameter field. As with most time values in SIMPL+, this time
value is specified in hundredths of seconds. The following program causes the
program to stop for five seconds before resuming.
42
•
SIMPL+
Programming Guide – DOC. 5789A