Rice Lake iRite IDE User Manual
Page 86

82
920i
Programming Reference
USBFileExists( filename : string )
This API checks to see if a file exists on the USB drive.
Parameters:
Filename
- The 920i will look in a folder named whatever the 920i's UID is set for (defaulted to 1) for the
filename sent as the parameter.
SysCode values returned:
SysOk
SysNoFileSystemFound
SysPortBusy
SysInvalidMode
SysBadfilename
Example:
USBFileExists(Testing.txt);
ReadLn( var data : string )
This API will read a string from whatever file is currently open. The string will be placed in a
string-type-variable that must be defined.
Parameters:
Data:
This is the string type variable that they data will be placed in to display or print or otherwise be used by
the program. It reads one line at a time and the entire line is in this string.
SysCode values returned:
SysOk
SysNoFileOpen
SysMediaChanged
SysNoFileSystemFound
SysEndOfFile
Example:
Result := ReadLn(sTempString);
--Reads a line of data from whatever file is open
while Result <> SysEndOfFile --Loops, looking at the return code until the end
loop
Result := ReadLn(sTempString);
WriteLn(3, sTempString);
--Prints each line read out Port 3
end loop;
WriteLn( port : integer; data : string )
Write( port : integer; data : string )
These APIs both writ out a port (and are not new to USB but can be used by the USB). If writing to the USB
drive it will append the string to the end of the currently open file. The only difference between the two is the
WriteLn sends a carriage return/line feed at the end, and Write does not.
Parameters:
Port
- Whichever port on the 920i the data will be sent out of. Port 2 is used for USB.
Example - see ReadLn.
GetUSBStatus() : Syscode
This API returns the most recent status report for the USB port. This is useful for validating a Write or WriteLn.
Example:
Result := GetUSBStatus;
GetUSBAssignment() : deviceType
Returns the DeviceType currently in use.
Example:
dDevice := GetUSBAssignment;
-- verify the assignment