background image

MCP3903 ADC EVALUATION BOARD

FOR 16-BIT MCUs USER’S GUIDE

©

 2011 Microchip Technology Inc.

DS51994A-page 11

Chapter 2.  Code Example

2.1

DSPIC33 EXAMPLE DESCRIPTION

If the user needs to evaluate the ADC on a system that uses dsPIC33 microcontrollers, 
then a PIM connector with a dsPIC33FJ256GA710A can be used on the evaluation 
board.

Using this example, the user can modify all MCP3903 internal registers from the PC 
software “MCP390x Data VIEW”. The UART communication speed is at 115.2 kbps.

2.1.1

SPI Communication

To transfer data from the ADC to the MCU, the SPI communication is controlled by 
DMA1. DMA1 channel is set up to use nul data write to read the MCP3903 register 
correctly. The DMA1 reads 7 bytes, but the first byte is not used. Before a new DMA 
read takes place, the CS pin must be controlled in the software and the MCU must wait 
for a new external interrupt 3 that indicates a new acquisition.

After the DMA1 transfer is finished, the DMA buffer content is moved into the Vch0 and 
Vch1 buffers. The loop is repeated until Vch0 and Vch1 are filled.

Timer 8 and Timer 9 are configured to work as a 32-bit timer. This timer starts when the 
acquisition is started and stopped when data buffers are full. The value indicated by this 
timer will be used to evaluate the sampling speed of the ADC on the PC interface.

After the buffers are filled with the samples, the internal registers of MCP3903 are read 
also using DMA1, now configured to read 16 bytes. The state of the MCP3903 internal 
registers will be stored into the MCU, since later they will be sent to the PC GUI.

To set the MCP3903 configuration registers, MCU must write on the SPI bus. For this 
purpose, the DMA0 channel is used and is set to do a thirteen bytes transfer from MCU 
to MCP3903.

2.1.2

UART Communication

To send the acquired samples from the MCU to the PC, the UART peripheral is used. 
On the board, the user can use the RS232 DB9 connector to connect to a serial port 
on PC side, or it can use the USB port that creates a virtual serial port on the PC, thanks 
to the MCP2200 USB to TTL converter that is connected to the MCU.

The RX pins of the MAX2323 and the MCP2200 are tightened together with the TX pin 
of the UART2 from the MCU. The user needs to select from jumperJ5 if the MCU 
receives data from MCP2200 or MAX2323. In firmware, the MCU is using DMA2 to do 
the transfer from MCU to the PC. To receive data from the PC through UART, the RX 
interrupt is used.

Содержание MCP3903

Страница 1: ...2011 Microchip Technology Inc DS51994A MCP3903 ADC Evaluation Board for 16 Bit MCUs User s Guide...

Страница 2: ...Technology Incorporated in the U S A All other trademarks mentioned herein are property of their respective companies 2011 Microchip Technology Incorporated Printed in the U S A All Rights Reserved P...

Страница 3: ...3 Analog Input Structure 9 1 4 USB to Serial Converter 9 Chapter 2 Code Example 2 1 dsPIC33 Example Description 11 Appendix A Schematics and Layouts A 1 Introduction 15 A 2 Schematic Analog 16 A 3 Sc...

Страница 4: ...MCP3903 ADC Evaluation Board for 16 Bit MCUs User s Guide DS51994A page 4 2011 Microchip Technology Inc...

Страница 5: ...re Appendix A Schematics and Layouts Shows the schematic and board layouts Appendix B Bill of Materials BOM Lists the parts used to build the MCP3903 ADC Evaluation Board for 16 Bit MCUs NOTICE TO CUS...

Страница 6: ...Save Bold characters A dialog button Click OK A tab Click the Power tab N Rnnnn A number in verilog format where N is the total number of digits R is the radix and n is a digit 4 b0010 2 hF1 Text in...

Страница 7: ...est software releases and archived software General Technical Support Frequently Asked Questions FAQs technical support requests online discussion groups Microchip consultant program member listing Bu...

Страница 8: ...MCP3903 ADC Evaluation Board for 16 Bit MCUs User s Guide DS51994A page 4 2011 Microchip Technology Inc NOTES...

Страница 9: ...s that communicate with the LabView GUI for data exchange and ADC setup 1 1 1 Feature Highlights Six channel ADC MCP3903 output display using serial communication to the PC Software Interface and LCD...

Страница 10: ...MCP3903 ADC Evaluation Board for 16 Bit MCUs User s Guide DS51994A page 6 2011 Microchip Technology Inc FIGURE 1 1 MCP3903 ADC Evaluation Board for 16 Bit MCUs...

Страница 11: ...is used for MCP3903 s clock generation Serial communication is achieved through the MSSP module 1 The MCP3903 device is an ADC with a second order modulator and a third order sync filter This Delta S...

Страница 12: ...se of the output compare module OC1 To use this make the following jumper change to the MCP3903 Digital I O header block FIGURE 1 4 ADC Clock Selection Jumpers Clock from MCU The signal frequency from...

Страница 13: ...onnecting the evaluation board to a PC On the board there is an MCP2200 USB to UART converter that creates a virtual COM port on the PC The MCP3903 ADC Evaluation Board for 16 Bit MCUs also features a...

Страница 14: ...MCP3903 ADC Evaluation Board for 16 Bit MCUs User s Guide DS51994A page 10 2011 Microchip Technology Inc NOTES...

Страница 15: ...r This timer starts when the acquisition is started and stopped when data buffers are full The value indicated by this timer will be used to evaluate the sampling speed of the ADC on the PC interface...

Страница 16: ...at the same time To select the desired channels the SW4 RD13 must be pressed S ta rt Initialis a tio n G et sa m p les in to b u ffe r 5 1 2 R ea d In terna l R e gis te rs W ait for P C G U I co m m...

Страница 17: ...n the acquired samples From the buffer length the user can select the amount of data that will be processed The maximum length is 512 From the Sampling Speed Control the user can change the sampling s...

Страница 18: ...been windowed For this the user must select the type of window from the Window control on the lower area of the main window The Histogram Graph can be used to investigate the distribution of the code...

Страница 19: ...contains the following schematics of the MCP3903 ADC Evaluation Board for 16 Bit MCUs Schematic Analog Schematic LCD and UART Schematic USB and Memory Schematic Microcontroller MCU Schematic PIM Modu...

Страница 20: ...DNP R10 GNDA GNDA GNDA 1K R95 1K R100 GNDA GNDA 68NF C7 GNDA DNP R9 GNDA 100NF C46 100NF C44 100 R63 3903_DR 3903_SDI 10k R57 GNDA GNDA GNDA GNDA 1 3 5 2 4 6 JP1 HDR3X2 1 3 5 2 4 6 JP8 HDR3X2 1 3 5 2...

Страница 21: ...1 PMPD1 RE0 PMPD0 RD14 U1CTS RC13 RF3 U1TX U6RX 1 3K R16 10K R15 100NF C12 GNDA NONE R17 NONE R18 RE4 PMPD4 RE3 PMPD3 100NF C34 100NF C36 1K R32 GNDA 100NF C30 GNDA GNDA 1K R33 100NF C35 MCP3903 Eval...

Страница 22: ...512MW 100NF C14 GNDA 18PF C32 RED D7 GM1JR35200AE 100 R38 SW3 B3S 1002P SW2 B3S 1002P 10K R21 GNDA 100NF C26 100NF C22 100NF C25 1 100NF C17 1K R37 1K R36 GNDA GNDA GNDA 1M R34 3 31 10 PIC24 ICD 100N...

Страница 23: ...ision Notes M 4 USB_ 5V RF3 U1TX U6RX RF2 U1RX GNDA 5 J2E 4 J2D 2 J2B 1 J2A 2 GNDA 470 R41 470 R47 GNDA GNDA 0 1uF C41 J5 HDR1X3 3 J2C USB DATAVIEW PORT 0 1uF C39 1 10 26 10 3 31 10 12MHz X1 RESONATOR...

Страница 24: ...RF2 U1RX RE5 PMPD5 GNDA RC13 3903_RESET 3 3V GNDA RB14 PMPA1 RG6 PMPA5 SCK2 RB0 AN0 3 3V RB15 PMPA0 RG0 RF5 PMPA8 U2TX RB1 AN1 3 3V GNDA RB14 PMPA1 RG6 PMPA5 SCK2 RB0 AN0 3 3V RB15 PMPA0 RG0 RF5 PMPA8...

Страница 25: ...Initial Design 4 GNDA 9V GNDA USB_ 5V USB GNDA 3 3V 5V GNDA GNDA GNDA 100 R58 3 3V POWER GNDA 1 P11A EXT 5V GNDA GNDA 3 2 1 J1 RAPC722 9V IN 10UF C4 2 P11B 100NF C3 GNDA POWER 9V IN GNDA 100NF C5 POWE...

Страница 26: ...MCP3903 ADC Evaluation Board for 16 Bit MCUs User s Guide DS51994A page 22 2011 Microchip Technology Inc A 8 BOARD TOP TRACE AND TOP SILK A 9 BOARD BOTTOM TRACE AND BOTTOM SILK...

Страница 27: ...Schematics and Layouts 2011 Microchip Technology Inc DS51994A page 23 A 10 BOARD LAYER 2 VDD A 11 BOARD LAYER 3 GND...

Страница 28: ...MCP3903 ADC Evaluation Board for 16 Bit MCUs User s Guide DS51994A page 24 2011 Microchip Technology Inc A 12 BOARD TOP SILK AND PADS A 13 BOARD BOTTOM SILK AND PADS...

Страница 29: ...Semi MBR0520LT1G 1 D5 LED BLUE 470NM CLEAR LENS 0603 Blue Para Light Corp L C191LBCT U1 1 D6 LED 570NM GRN WHT DIFF 0603 SMD Rohm Semi SML 512MWT86 1 D7 LED RED 470NM CLEAR LENS 0603 Red Para Light C...

Страница 30: ...ALL 4 R13 R19 R23 R30 RES 4 70K OHM 1 10W 1 0603 SMD Rohm Semi MCR03EZPFX4701 8 R14 R20 R24 R31 R32 R33 R36 R37 RES 1 00K OHM 1 10W 1 0603 SMD Rohm Semi MCR03EZPFX1001 3 R21 R57 RES 10 0K OHM 1 10W 1...

Страница 31: ...1 U1 IC REG LDO 800MA 5 0V SOT 223 National Semi LM1117MP 5 0 NOPB 1 U3 IC REG LDO 800MA 3 3V SOT 223 National Semi LM1117MP 3 3 NOPB 1 U6 IC DRVR RCVR MLTCH RS232 20TSSOP Texas Instruments SN75C3223P...

Страница 32: ...na Shanghai Tel 86 21 5407 5533 Fax 86 21 5407 5066 China Shenyang Tel 86 24 2334 2829 Fax 86 24 2334 2393 China Shenzhen Tel 86 755 8203 2660 Fax 86 755 8203 1760 China Wuhan Tel 86 27 5980 5300 Fax...

Отзывы: