GPIB to USB Interface, Elektor 2012-11

Anders Gustafsson was so friendly, and has programmed in a good style a GPIB to USB converter presented in the magazine Elektor 2012-11. The whole thing is much cheaper than commercial circuits, for hobby purpose.

Unfortunately, by not using a GPIB bus driver, it is only possible to connect not more than 4 GPIB device. The PIC18F2553 CPU can deliver up to 200 mA at the I / O ports in total. Per output, but it should not be more than 8.5 mA in order not to exceed the voltage of 0.6 V for the LOW level. With IEEE-488 GPIB standard, each device on the bus has a termination 3 KOhm resistor to +5V and 10 KOhm to 0V.

/!\ The newer PIC18F2553 has a 12 bit A/D converter, instead of 10 bit in the PIC18F2550.

Development Software

You need from http://microchip.com the development software MPLAB X IDE version 1.60 or higher.

You need from http://microchip.com the USB Framework for PIC18 from the Microchip Libraries for Applications (MLA version 2.9), please see at Links.

You need a programmer, I have bought a PICkit3 clone. This programmer, allows also single stepping the program. Just the USB enumeration in the host computer does not work in this case, or needs a special handling, which I do not know yet.

* Follow the instructions in file readme.txt from Anders Gustafsson to include the USB library.

In the folder microchip_solutions_xxx/USB/Device - CDC - Basic Demo make a copy of the folder Firmware to Firmware_GPIB. In folder Firmware_GPIB edit file HardwareProfile.h as mentioned in file Pic2550.txt, but change the number 2550 to 2553 if this CPU is used.

Set in the Project Properties the Device to PIC18F2553.

You are using the project USB/Device - CDC - Basic - Demo. Unfortunately, if you open this project in MPLAB X you get an Project Loading Error with the text: "Some of the files in this Project "MPLAB" contain spaces or odd characters in their name or their path. This could potentially cause issues during the build process. This is a limitation of GNU Make tool that we use as part of our build process. Removing spaces from all file and folder names included in this project will eliminate this potential issue."
So I tried to rename all folder and file names to remove the spaces.

In the project folder Linker Files you need the file rm18f2553_g.lkr which can be found in path USB/Device - Bootloaders/HID/Firmware - PIC18 Non-J/Linker files for applications of package MLA.

In the folder Firmware_GPIB copy the file main.c to folder MPLAB.X and modify according to the readme.txt file from Anders. To my surprise 2 header files from Microchip must have a different path, in order to be found:

//#include "./USB/usb.h"
//#include "./USB/usb_function_cdc.h"
#include "USB/usb.h"
#include "USB/usb_function_cdc.h"

The USB header files are in path Microchip/Include/USB of MLA.

Then change in Project/Source Files the file main.c to the copy in folder Firmware_GPIB.

Simplified Hardware

If you buy all parts for this project individual, it is easy to exceed 70 EUR.

In order to make it a bit cheaper, I ordered the USB Bit Whacker - 18F2553 PTH Kit, the GPIB plug and the resistors for less than 35 EUR, please see at Links.

/!\ The 6 pin programmer connector has the pin 1 marking (square pad) on the wrong side.

The 330 Ohm resistors for the LED's D2 and D3 should not be soldered, in order to avoid the strong pullup on the GPIB lines. Also the resistor R1 and momentary switch S2 (PRG) should not be soldered, because of the same reason.

For debug use, R3 (330 Ohm) could be connected to the PIC processor on pin 2, which is not used this application. So, you can signal with the red LED like:

    // flash red LED on RA0 (pin 2) for test
    ADCON1 |= 0x0F;     // use digital output
    TRISA = 0xfe;       // was 0xff, change for red LED
    LATA |= 0x01;
    Delay1KTCYx(1000);
    LATAbits.LATA0 = 0;

On the left picture you can se the assembled kit of the USB Bit Whacker, on the right picture the PIC board mounted on an adapter board to the GPIB plug, plus the pull-up and series resistors for the bus. The adapter board was once made to hold an Arduino Nano3 module.

attachment:GPIB_USB_PIC_UBW_DSC04996.jpg

attachment:GPIB_USB_PIC_plug_DSC05002.jpg

In order to sees something of the diagram here as a PNG file. Plus a PDF file for better printout GPIB_PIC_Adapter.pdf.

attachment:GPIB_PIC_Adapter.png

Converter Firmware

The actual source code for the firmware of the converter can be downloaded at a page of the author, please see at Links.

Test of the circuit

In order to test the basic function of the program and the interface, you need a terminal program. May I suggest PUTTY (freeware) for Linux and Windows. For MAC OS X I use CoolTerm (freeware).

The baud rate is not important in this case, because there are no real serial/parallel converters in action, which has to be synchronized.

PUTTY Parameters, Session:
  Connection Type: serial
  Serial line: COMx (x = USB Serial Emulation Nummer, z.B. 6)
  Speed: 38400

Keyboard input (blind, no Echo): "++ver", strg"J" (upper case I, Control+J = LineFeed)

Answer, or similar:
GPIB-USB version 9.12 - www.dalton.ax/gpib

or in MAC OS X use program CoolTerm, which finds the serial port,
   in this case "/dev/tty.usbmodem5d21"

All that was tested under Virtual Box V.4.2.18 in MAC OS X 10.8.5

* PIC based USB to GPIB adapter, with drivers

List of pages in this category:

-- RudolfReuter 2013-10-21 16:50:44


Go back to CategoryLogicAnalyzer or FrontPage ; KontaktEmail (ContactEmail)

GPIBtoUSB_PIC (last edited 2014-02-09 19:21:43 by RudolfReuter)