Home › Magazines › 2007 › November › USB Data Acquisition Card

USB Data Acquisition Card

digital & analogue; input & output

Published in issue 371, November 2007

USB Data Acquisition Card
This data acquisition card for connection to the USB has eight digital outputs, eight digital inputs, two 10-bit analogue outputs and eight 10-bit analogue inputs for voltage swings of 0 to 5 V. The system’s core is a Microchip USB-savvy microcontroller type PIC18F4550 programmed in C. The circuit is built on a compact PCB and requires no external power supply.

Hardware

In the circuit diagram, the USB+ and USB– pins on K2 should be swapped. The PCB track layout shown in the article should also be corrected. PCBs supplied through the Elektor Shop have the correct USB signal routing and are not affected.

Although different values are indicated in the circuit diagram and the parts list, both 27 Ω and 33 Ω resistors may be used in positions R3 and R4.

 

Software

Contrary to what some readers have written there is no bug in the firmware CUSTOM_TAD. If it is compiled with MPLAB C18 C Compiler v3.02 as described in the magazine, in the section ‘PIC Firmware’, it compiles perfectly (6 warnings appear, without importance) and the .hex file is generated without problems.

 

However, if the firmware is compiled with a later version of the C18 Compiler, for instance, with MPLAB C18 C Compiler v3.14 (recent version), some errors appear that inhibit compilation. To be able to compile successfully, the following modifications must be made:

1. File main.c, line 52

      Text: #pragma config FCMEM = OFF

      Should be: #pragma config FCMEN = OFF

2. File user.c, line 76

      Text: OpenPWM2(0xFF);

      Should be: TRISCbits.TRISC1=0; CCP2CON=0b00001111;

3. File user.c, line 79

      Text: OpenADC(ADC_FOSC_64 & ADC_RIGHT_JUST & ADC_6_TAD,ADC_CH0 & ADC_INT_OFF & ADC_VREFPLUS_VDD & ADC_VREFMINUS_VSS,7);

      Should be: OpenADC(ADC_FOSC_64 & ADC_RIGHT_JUST & ADC_6_TAD,ADC_CH0 & ADC_INT_OFF & ADC_REF_VDD_VSS,7);

 

These tree changes are indispensable. After making the changes the firmware is compiled perfectly (6 warnings appear, without importance) and the .hex file is generated correctly.

 

To be able to execute the software for the PC it is necessary that Microsoft .NET Framework is installed (free downloaded from Microsoft via Windows Update).

Click below to download a PDF copy of this article from Elektor magazine.

 

Downloads 

PDF article
10 Elektor Credits
PDF PCB
Free download
 

Order this magazine 

Magazine November 2007
UK371 (US $ 6.20)
 

Order from Elektor 

PCB, bare
070148-1 (US $ 18.60)
PIC18F4550 DIP40, programmed
070148-41 (US $ 25.00)
 

Free downloads 

Software

Free download

Extra info

Free download

Please note. In view of the complexity of international markets, Elektor cannot guarantee the availability of components for this project.

Subscribe now

Subscribe to our free
E-weekly Newsletter!

Enter your Email address:

Front Panel Express


Design your unique front panel with our free CAD software - it is quick and easy! Front Panel Express will machine your design with modern CNC technology. You will receive the panel exactly as you need it in a couple of days.
Instant download

FAQ

Before submitting questions, review our FAQ section!

Spotlight

Elektor 1990 through 1999

This DVD-ROM contains the full range of 1990-1999 volumes (110 issues, more than 2,100 articles) of Elektor Electronics magazine.