Programmers Guide
All necessary structures, types, constants, and feedback messages of
the software driver (error messages) can be found in FARC.H.
You should include this file in your application.
The example program (SIMPLE.C) delivered with this software driver shows how to access the software driver. Some more samples of using the driver can be found in this helpfile.
For effective working it is recommended, that the driver is accessed asynchronously. Only in asynchronous mode it is possible to perform ReadFile and WriteFile at the same time (i.e. in several threads).
Access to the software driver follows Standard File Functions:
CreateFile (...) opens the driver
CloseHandle (...) closes the driver
ReadFile (...) or ReadFileEx(...) reads received packages
WriteFile (...) or WriteFileEx(...) sends packets (data)
DeviceIoControl (...) Controller initialization, Status information, etc., see list of IOCTL-Numbers below
For a more detailed description of these functions please consult
the
manuals of your
compiler (WIN-API Functions) or the SDK from Microsoft.
When using the driver in asynchronous mode
(recommended, see also here), the
overlapped
structure must be used in ReadFile, WriteFile and DeviceIoControl. If
not,
system crashes may occur!
General notes
The driver works complete transparent. No protocol is implemented.
Have in mind, that the controller is capable of receiving 2 packets.
No further buffering is done within the controller or the driver.
The best way to ensure, not to loose any transferred data (broadcast
messages) on the net, start a thread, that only performs
ReadFile-Operations.
If a ReadFile completes with data received, store the received data,
wherever
you want and start the ReadFile again. It is good practice, to have 2
ReadFiles
permanently running in the above mentioned thread.
Nevertheless, Windows is NOT a realtime operating system. Therefor it cannot be guaranteered, that the driver will always and under every circumstances read out the incoming data from the ARCNET controller before the next packets arrive. Heavy system load (i.e. swapping) may lead to loss of data (broadcast receives) and timeouts may occur on the transmitting station (EXCNAK), if ARCNET data is sent to the adapter on the Windows machine.
typically driver access sequence:
1. CreateFile(...)
2. DeviceIoControl(IOCTL_FARC_INIT,.....)
3. Send / receive packets and process data (e.g. WriteFile(...))
4. DeviceIoControl(IOCTL_FARC_DEINIT,....)
5. CloseHandle(...)