GPIB_AVR
|
These files implement a GPIB controller. No special hardware is used, the port lines of the AVR is used 'as is'.
To run the software, it must be compiled according to your hardware. See gpib.h for the assignments of AVR port lines to GPIB interface lines. You can change the defines in gpib.h according to your hardware. I used for testing the AVR board from pollin priced ca. 15 Euro. Every other board is possible as long as you have enough port lines available. 16 ports are required.
Set up GPIB bus addresses for your devices. The setup is done in/at the device. Check device manual.
The software assumes two devices with addresses 0x01 and 0x02. The controller itself has address 0x00. You can change number of devices and assumed addresses in function gpib_controller_assign().
This code implements a kind of a GPIB controller. It understands a few built in commands. The hardware should be connected via GPIB interface, the controlling computer/terminal via RS232. Then the following commands can be used:
In debug shell mode, some low level GPIB bus commands are possible.
When in normal input mode, device commands can be entered. For commands that will have an answer from the device under control, the answer is print out to the terminal. The controller is also able to do a serial poll. The code was tested with a Tektronix 2432a oscilloscope and with a Tektronix 1241 logic analyzer. The implementation may be specific to Tektronix and may not work with other devices. But it's worth a try.
The implementation of GPIB protocol and controller functions itself is in gpib.h and gpib.c. The controller is implemented in main_gpib.c as a big never-ending loop. When errors occur during communication, the controller enters the debugging shell function, implemented in debugshell.h and debugshell.c. Errors are usually timeouts because the device behaves different then the controller expected. The timeout functionality is implemented as 16 bit timer in timer16.h and timer16.c. For generic common defines the file defs.h is used. The Doxygen file contains doxygen controls (automatic creation of documentation from source).
Here are some commands for testing.
This code can be used according to GNU General Public License.