For quick testing of digital circuits and chips I often use the parallelport because it is easy to program in C and QBasic. But writing a program for every new circuit takes to much time. So I wrote a little program to control the parallelport via a nice GUI.
When you start the executable, you get the Port-Control-Screen, which is divided into the three registers that contain the pins of the port. The pins can be set individually or a script can be created, which places the bitpatterns on the port automatically. Therefore you must select a port, enter the hex-value of the byte, and click ‘Add’. Delays work the same way. The script can be saved and loaded via the contextmenu of the listbox. You can also write the script with any editor, as long as the same syntax is used.
The ‘Run’-button runs the script n times, with n being the number in the field next to the button.
The I²C-Mode is activated with the button of the same name.
Here you have a sequence-listbox, the available actions, the necessesary parameters and a listbox which displays the recieved data. Just select the desired action, enter hex-value of the byte to send or delay (if necessary) and click ‘Add’. The contextmenu of the sequence-listbox provides save and load for the scripts.
In datasheets for i²c-chips you often only find binary values for the commands to send. So I included a field which converts the binary values to hexadecimal numbers. Instead of entering the binary value you can also select the bits directly. The value is loaded into the datafield by clicking the small ‘<‘ button right next to it.
After clicking ‘Run’ it is first checked, if the bus is ready, that is if SCL and SDA are both high (idle). Then the sequence is processed.
The pins are hardcoded for my parallel-i²c-adapter, which can be found here. If you have a different interface, you can change the code. Maybe I will in include those options in the next version.
Delphi6 sourcecode can be found here (executable and inpout32.dll included).
(I only use the code on a Win98 PC, where the inpout32.dll is sufficient. To use it with Win2K or XP you need something like DirectIO.)