Home › Revistas › 2008 › Janeiro › Placa para aquisição de dados USB

Placa para aquisição de dados USB

Entrada/saída digital e analógica

Publicado na Edição 277, Janeiro 2008

Placa para aquisição de dados USB

Esta placa de aquisição de dados para ligar ao porto USB possui oito saídas digitais, oito entradas digitais, duas saídas analógicas com uma resolução de 10 bits e oito entradas analógicas de 10 bits, para tensões que variam entre 0 e 5 V. O núcleo do sistema é o microcontrolador PIC18F4550 da Microchip, programado em linguagem C. O circuito é montado numa placa de circuito impresso muito compacta e não requer nenhuma fonte de alimentação externa.

Actualizações, informação extra

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).

Clique aqui para descarregar o PDF deste artigo da revista Elektor. 

 

Downloads 

Artigo PDF
10 Créditos Elektor
Desenho da placa em PDF
Download gratuito
 

Toda a revista 

Revista Janeiro 2008
PT277 (USD 6,70)
 

Encomende à Elektor 

PCI sem componentes
070148-1 (USD 20,00)
PIC18F4550 I/P, programado
070148-41 (USD 32,70)
 

Downloads gratuitos 

Software

Download gratuito

Informação adicional

Download gratuito

Atenção! Devido à complexidade dos mercados internacionais, a Elektor não garante que todos os componentes deste projecto estejam disponíveis.

FANTÁSTICA PROMOÇÃO!

Após vários pedidos, resolvemos lançar esta fantástica campanha a todos os nossos leitores!

 

50% de desconto sobre o preço de capa ao fazeres a tua assinatura.

 

E como OFERTA de boas-vindas recebe GRÁTIS O E-book Microcontroller Basics.

 

Subscreva!

A e-weekly, a newsletter semanal da Elektor, chega ao seu e-mail todas as sextas, com os ultimos avanços na área da electrónica!

 

A não perder!

E-Créditos

Favorito:

Versão disponível apenas em Inglês

 

“311 Circuits” é o 12º livro da aclamada série 300 da Elektor. Uma enorme fonte de inspiração para todos os entusiastas e profissionais da electrónica, esta publicação merece um lugar de destaque bem próximo do espaço de trabalho.