Using a PC to Experiment with the MAX7300/MAX7301 Port Expanders
RequirementsA PC running Windows® 95, 98, 98SE, ME, NT, 2000, or XP with a parallel printer port configured for either LPT1 or LPT2.
DescriptionThe utility is a Visual Basic 5 program called MAX7300.EXE which requires the standard Visual Basic run time library MSVBVM50.DLL in order to run at all. The program uses the DriverLINX™ freeware parallel port driver DLPortIO.DLL which provides the Win32 DLL hardware I/O functions not available as standard in Visual Basic. Windows NT and 2000 users also require the DLPortIO.SYS kernel mode driver. Both of these drivers are copyright Scientific Software Tools, Inc. (www.driverlinx.com). DriverLINX is a registered trademark of Scientific Software Tools, Inc.
InstallationTo install to a Windows 95, 98, 98SE, ME platform, download the MAX7300-01.EXE file (812kB). This is a WinZIP self-extracting archive that contains ReadMe.txt, ReadMeSST.txt, MAX7301.EXE, DLPortIO.DLL, and MSVBVM50.DLL. The default download directory is C:\MAX7300. MSVBVM50.DLL may be deleted if the library is already registered on the computer.
To install to a Windows NT, 2000, or XP platform, download the MAX7300-NT.EXE file (2.3MB). This is a WinZIP self-extracting archive that contains ReadMe.txt, ReadMeSST.txt, MAX7300.EXE, PORT95NT.EXE, and MSVBVM50.DLL. The default download directory is C:\MAX7300. PORT95NT.EXE is the install program for the DriverLINX drivers which installs and registers the DLPortIO.DLL library and DLPortIO.SYS driver. PORT95NT.EXE can be deleted after installation. Windows 95, 98, 98SE, ME users can also use this installation procedure if they wish.
Connecting a MAX7300 or MAX7301 to the Parallel PortThis utility uses 3 of the 8 parallel port printer output lines to simulate SPI serial interface activity, and another 2 output lines to simulate I²C serial interface activity. Parallel port control input lines are used to read back SPI data, I²C data, and interrupt status. Multiple (up to 16, daisy-chained) MAX7301s and/or multiple (up to 16, configured with different I²C addresses) MAX7300s may be operated at once. Either the LPT1 or LPT2 port may be selected from the software. The port can be a standard, ECP, or EPP type. The port connections are shown in Figure 1.
Figure 1. The MAX7300 and MAX7301 connections to the parallel port.
The program brings up 3 windows on startup. These are the main control, I/O control, and port control windows. The register settings on start-up mirror the register power-up conditions of the MAX7300 and MAX7301.
The main control is shown in Figure 2 below. The 'Driver type' radio buttons select whether the software will transmit to MAX7301 (using the SPI connection) or the MAX7300 (using the I²C connection).
Figure 2. Program display on startup.
In SPI mode, the software controls up to 16 MAX7301 drivers. The drivers are presumed to be cascaded, (i.e., the DOUT pin of the first MAX7301 connects to the DIN pin of the second MAX7301, whose DOUT pin connects to the DIN pin of the third MAX7301, and so on). The total number of MAX7301 devices is set by the 'Number of Drivers' slider. When this is set to more than 1, the 'Enable global driver write' and 'Enable auto-increment' check boxes are available. When 'Enable global driver write' is clear, only the MAX7301 driver selected by the 'Current Driver' slider is written to when a write command is selected - the others receive the no-op instruction. When 'Enable global driver write' is checked, all the MAX7301 drivers are written to with the same data. When 'Enable auto-increment' is checked, the current driver number is automatically incremented after each write action. This allows the user to quickly send the same data for a series of MAX7301 drivers.
The SPI interface connection to the parallel port can be tested with the 'Test Stream' facility which can be found under 'Port Connections and Help...' when the program is running. The 'Test Stream' facility transmits the no-op instruction continuously to the MAX7301(s) (as set by the 'Number of Drivers' slider) allowing the interface connections to be verified without affecting register contents.
In I²C mode, the software controls up to 16 MAX7300 drivers. The first driver is presumed to be set to address 1000000x, with the addresses of subsequent devices increasing to 1001111x for the last device. To access, for example, a single MAX7300 driver at address 1001111x, simply set the 'Number of Drivers' slider to 16 and then the 'Current Driver' slider to 16, address 1001111x. The main form in I²C mode is shown in Figure 3.
Figure 3. I²C program display.
The I²C interface connection to the parallel port can be tested with the 'Test Stream' facility which can be found under 'Port Connections and Help...' when the program is running. The 'Test Stream' facility transmits the no-op instruction continuously to all MAX7300(s) (as set by the 'Number of Drivers' slider) allowing the interface connections to be verified without affecting register contents.
The 'Fast serial interface' check box sets the serial interface speed for both SPI and I²C interface types. When checked, serial interface runs at machine-dependent full speed up to 1 Mbits/sec; unchecked, the speed is limited to 500 bits/sec maximum. The slow speed may be useful when connecting over very long cables.
The program will normally only communicate with the target driver (or drivers) when a 'Write' or 'Read' button is pressed. However, the program attempts to monitor an interrupt output pin presumed to be connected to the parallel port pin 13. This is displayed on the main window and displays status as High or Low.
The 'Automatic Update control' button, when checked, makes the program continually poll all 28 port input registers and the interrupt register bit. The reading rate depends on the setting of the 'Fast serial interface' check box, and is many times a second (Fast) or every many seconds (Slow). Note: slow mode is very slow! The 'Reading driver x' slider allows the user to set the device being automatically read independently to the driver(s) accessible through the 'Current driver' control.
The main window is the route to Exit the program. The Exit button, or pressing the Esc key on the main window, closes all 3 windows. Pressing the Esc key in one of the other 2 windows takes the user to the main window; therefore, pressing the Esc key twice will close the program quickly. Before closing, the program stores the last settings for device configuration in a file called MAX7300.ini in the same directory that the program was executed from. Nothing is written to Windows registry. The settings includes the positions of the 3 windows, and the interface settings on the main window. If the MAX7300.ini doesn't exist then it is created; otherwise it is overwritten. To restore program default settings, or if the MAX7300.ini is corrupted, simply delete the MAX7300.ini file.
Figures 4 and 5 show snapshots of the other two windows.
Figure 4. I/O configuration window.
Figure 5. Port registers window.