Function prototypes in "IgorUSB.dll" library:
Delphi:
const
IgorUSBDLL=
'IgorUSB.dll';
//return values from IgorUSBDLL functions:
NO_ERROR = 0;
DEVICE_NOT_PRESENT = 1;
NO_DATA_AVAILABLE = 2;
INVALID_BAUDRATE = 3;
OVERRUN_ERROR = 4;
function DoGetInfraCode(var
TimeCodeDiagram:array of
byte; var DiagramLength:integer):integer;
stdcall external IgorUSBDLL name 'DoGetInfraCode';
function DoSetDataPortDirection(DirectionByte:byte):integer;
stdcall external
IgorUSBDLL name 'DoSetDataPortDirection';
function DoGetDataPortDirection(var
DataDirectionByte:byte):integer;
stdcall
external IgorUSBDLL name 'DoGetDataPortDirection';
function DoSetOutDataPort(DataOutByte:byte):integer;
stdcall external IgorUSBDLL
name 'DoSetOutDataPort';
function DoGetOutDataPort(var
DataOutByte:byte):integer;
stdcall external
IgorUSBDLL name 'DoGetOutDataPort';
function DoGetInDataPort(var
DataInByte:byte):integer;
stdcall external
IgorUSBDLL name 'DoGetInDataPort';
function DoEEPROMRead(Address:byte;
var DataInByte:byte):integer;
stdcall
external IgorUSBDLL name 'DoEEPROMRead';
function DoEEPROMWrite(Address:byte;
DataOutByte:byte):integer;
stdcall external
IgorUSBDLL name 'DoEEPROMWrite';
function DoRS232Send(DataOutByte:byte):integer;
stdcall external IgorUSBDLL name
'DoRS232Send';
function DoRS232Read(var
DataInByte:byte):integer;
stdcall external IgorUSBDLL
name 'DoRS232Read';
function DoSetRS232Baud(BaudRate:integer):integer;
stdcall external IgorUSBDLL
name 'DoSetRS232Baud';
function DoGetRS232Baud(var
BaudRate:integer):integer;
stdcall external
IgorUSBDLL name 'DoGetRS232Baud';
C++ Builder / Microsoft Visual C++:
#ifdef __cplusplus
extern "C" {
#endif
#define IgorUSBDLL
"IgorUSB.dll";
//return values from IgorUSBDLL functions:
#define NO_ERROR
0;
#define DEVICE_NOT_PRESENT 1;
#define NO_DATA_AVAILABLE
2;
#define INVALID_BAUDRATE
3;
#define OVERRUN_ERROR
4;
int __stdcall DoGetInfraCode(uchar
*
TimeCodeDiagram, int DummyInt,
int
* DiagramLength);
int __stdcall DoSetDataPortDirection(uchar
DirectionByte);
int __stdcall DoGetDataPortDirection(uchar
* DataDirectionByte);
int __stdcall DoSetOutDataPort(uchar
DataOutByte);
int __stdcall DoGetOutDataPort(uchar
* DataOutByte);
int __stdcall DoGetInDataPort(uchar
* DataInByte);
int __stdcall DoEEPROMRead(uchar
Address, uchar
* DataInByte);
int __stdcall DoEEPROMWrite(uchar
Address, uchar
DataOutByte);
int __stdcall DoRS232Send(uchar
DataOutByte);
int __stdcall DoRS232Read(uchar
* DataInByte);
int __stdcall DoSetRS232Baud(int
BaudRate);
int __stdcall DoGetRS232Baud(int
* BaudRate);
#ifdef __cplusplus
}
#endif
Visual Basic:
Public Const IgorUSBDLL="IgorUSB.dll";
'return values from IgorUSBDLL functions:
Public Const NO_ERROR
= 0;
Public Const DEVICE_NOT_PRESENT
= 1;
Public Const NO_DATA_AVAILABLE
= 2;
Public Const INVALID_BAUDRATE
= 3;
Public Const OVERRUN_ERROR
= 4;
Public Declare Function DoGetInfraCode
Lib "IgorUSB.dll" (ByRef TimeCodeDiagram
As Any, ByVal
DummyInt
As Long, ByRef
DiagramLength As Long) As
Long
Public Declare Function DoSetDataPortDirection
Lib "IgorUSB.dll" (ByVal DirectionByte
As Byte) As
Long
Public Declare Function DoGetDataPortDirection
Lib "IgorUSB.dll" (ByRef DataDirectionByte
As Byte) As
Long
Public Declare Function DoSetOutDataPort
Lib "IgorUSB.dll" (ByVal DataOutByte
As Byte) As
Long
Public Declare Function DoGetOutDataPort
Lib "IgorUSB.dll" (ByRef DataOutByte
As Byte) As
Long
Public Declare Function DoGetInDataPort
Lib "IgorUSB.dll" (ByRef DataInByte
As Byte) As
Long
Public Declare Function DoEEPROMRead
Lib "IgorUSB.dll" (ByVal Address
As Byte, ByRef
DataInByte As Byte)
As Long
Public Declare Function DoEEPROMWrite
Lib "IgorUSB.dll" (ByVal Address
As Byte, ByVal
DataOutByte As Byte)
As Long
Public Declare Function DoRS232Send
Lib "IgorUSB.dll" (ByVal DataOutByte
As Byte) As
Long
Public Declare Function DoRS232Read
Lib "IgorUSB.dll" (ByRef DataInByte
As Byte) As
Long
Public Declare Function DoSetRS232Baud
Lib "IgorUSB.dll" (ByVal BaudRate
As Long) As Long
Public Declare Function DoGetRS232Baud
Lib "IgorUSB.dll" (ByRef BaudRate
As Long) As
Long
function DoGetInfraCode(var TimeCodeDiagram:array of byte; var DiagramLength:integer):integer; stdcall external IgorUSBDLL name 'DoGetInfraCode';
Function reads last received Infrared Code from
microcontrollers infrared buffer and frees this infrared buffer.
Parameters
TimeCodeDiagram
[out] Array of bytes for infrared
code storing. Every byte in this array represents duration of one signal level (H or
L level). Duration
is in 85.3us steps (e.g. number 10
represents 853us duration of L or H level). Last number in array (with index DiagramLength)
has
L level and the levels alternates in array (LHL.....HLHLHL).
Maximum length of this array is 256.
DiagramLength
[out] Length of returned TimeCodeDiagram
array.
If DiagramLength=0 then no code was received since last request.
Return values
If the function succeeds, the return value is NO_ERROR.
If the function
fails, the return value is DEVICE_NOT_PRESENT (device is disconnected).
Notes:
Microcontroller stores infrared code into its internal
buffer. If another code was received before reading stored code from
microcontroller
by this function, then the second (3-th, 4-th, ...) code are
lost.
function DoSetDataPortDirection(DirectionByte:byte):integer; stdcall;
Function sets transfer direction of microcontroller data
pins (D0-D7).
Parameters
DirectionByte
[in] Byte which bits represents
direction of given microcontroller pin. Bit value 1 represents output and bit
value 0 represents input.
Return values
If the function succeeds, the return value is NO_ERROR.
If the function
fails, the return value is DEVICE_NOT_PRESENT (device is disconnected).
function DoGetDataPortDirection(var DataDirectionByte:byte):integer; stdcall;
Function reads transfer direction of microcontroller data
pins (D0-D7).
Parameters
DataDirectionByte
[in] Byte which bits represents
direction of microcontroller data pins. Bit value 1 represents output and bit
value 0 represents input.
Return values
If the function succeeds, the return value is NO_ERROR.
If the function
fails, the return value is DEVICE_NOT_PRESENT (device is disconnected).
function DoSetOutDataPort(DataOutByte:byte):integer; stdcall;
Function sets given state on microcontroller output data
pins or set pull-up resistors on microcontroller input data pins (D0-D7).
Parameters
DataOutByte
[in] Byte which bits represents
output levels on data pins - if pins are in output direction. If data pin(s) are in input
direction
then bit value 1 switch on pull-up
resistor and bit value 0 switch off pull-up resistor (high impedance input) on
input data pin.
Return values
If the function succeeds, the return value is NO_ERROR.
If the function
fails, the return value is DEVICE_NOT_PRESENT (device is disconnected).
function DoGetOutDataPort(var DataOutByte:byte):integer; stdcall;
Function reads state of microcontroller output
level/pull-up values.
Parameters
DataOutByte
[out] Byte which bits represents
output levels written to data pins - if pins are in output direction. If pin(s) are
in input direction
then bit value 1 represent switched
on pull-up resistor and bit value 0 represent switched off pull-up resistor
(high impedance
input) on input data pin.
Return values
If the function succeeds, the return value is NO_ERROR.
If the function
fails, the return value is DEVICE_NOT_PRESENT (device is disconnected).
Notes:
The output values are not read from physical pins, but from
internal register (stored value). For reading true physical values
on output data pins use function DoGetInDataPort.
function DoGetInDataPort(var DataInByte:byte):integer; stdcall;
Function reads state of microcontroller data pins (D0-D7).
Parameters
DataOutByte
[out] Byte which bits represents levels on data pins
(level on physical pins).
Return values
If the function succeeds, the return value is NO_ERROR.
If the function
fails, the return value is DEVICE_NOT_PRESENT (device is disconnected).
function DoEEPROMRead(Address:byte; var DataInByte:byte):integer; stdcall;
Function reads byte from given address of microcontroller data EEPROM.
Parameters
Address
[in] Byte which bits represents
address of internal EEPROM (valid address range: 0 to 127).
DataInByte
[out] Value from EEPROM.
Return values
If the function succeeds, the return value is NO_ERROR.
If the function
fails, the return value is DEVICE_NOT_PRESENT (device is disconnected).
function DoEEPROMWrite(Address:byte; DataOutByte:byte):integer; stdcall;
Function writes byte to given address of microcontroller data
EEPROM.
Parameters
Address
[in] Byte which bits represents
address of internal EEPROM (valid address range: 0 to 127).
DataOutByte
[in] New value to write to EEPROM.
Return values
If the function succeeds, the return value is NO_ERROR.
If the function
fails, the return value is DEVICE_NOT_PRESENT (device is disconnected).
Notes:
Function waits for storing byte to EEPROM (write time is
cca 4ms).
function DoRS232Send(DataOutByte:byte):integer; stdcall;
Function sends byte to microcontroller RS232 line at
current baudrate.
Parameters
DataOutByte
[in] Value to send to microcontroller
RS232 line.
Return values
If the function succeeds, the return value is NO_ERROR.
If the function
fails, the return value is DEVICE_NOT_PRESENT (device is disconnected).
Notes:
Function waits for transmitting given byte: all data bits + stop
bit are transmitted before function end.
function DoRS232Read(var DataInByte:byte):integer; stdcall;
Function reads byte received by microcontroller RS232
line.
Parameters
DataInByte
[out] Byte received from
microcontroller RS232 line.
Return values
The return values are:
NO_ERROR - one byte received (returned in DataInByte)
NO_DATA_AVAILABLE - no data was received (value DataInByte
is not valid)
OVERRUN_ERROR - more bytes was received, but
another received bytes was lost: in DataInByte is returned only the first received
byte
DEVICE_NOT_PRESENT - error: device is
disconnected
function DoSetRS232Baud(BaudRate:integer):integer; stdcall;
Function sets speed of microcontroller RS232 line.
Parameters
BaudRate
[in] Required baudrate of
microcontroller RS232 line (in bps).
Return values
The return values are:
NO_ERROR - baudrate was set (error between required
and set baudrate is less than 4%)
INVALID_BAUDRATE - not supported baudrate - baudrate
was not set (error from required baudrate is more than 4%)
DEVICE_NOT_PRESENT - error: device is
disconnected
Notes:
Valid baudrates are cca from 2900 Baud to 780 000 Baud.
Supported "standard" baudrates are 4800,
9600,19200,38400,57600.
To know internal baudrate - use function DoGetRS232Baud.
After power on - the baudrate is set to 57600.
function DoGetRS232Baud(var BaudRate:integer):integer; stdcall;
Function reads current baudrate of microcontroller RS232
line.
Parameters
BaudRate
[out] Exact value of current baudrate
of microcontroller RS232 line.
Return values
If the function succeeds, the return value is NO_ERROR.
If the function
fails, the return value is DEVICE_NOT_PRESENT (device is disconnected).
Notes:
Function returns exact current baudrate value - may be
slightly different from the required value (error up to 4%).
For more information see also file IgorUSB.pas .
Copyright © 2002-2003 Ing. Igor Cesko, Slovakia, www.cesko.host.sk