Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

MCP3913 Analong Input

Status
Not open for further replies.

VirusX2

Member level 4
Joined
Nov 18, 2014
Messages
74
Helped
1
Reputation
2
Reaction score
0
Trophy points
6
Activity points
544
Hi everyone, can i feed the MCP3913 with 0.7Vac rms signal? The datasheet say that the maximum input voltage is +-1V but this is AC or DC? I have a CT that give me an 0.7Vac rms output (+0.9898V to - 0.9898V). have i to amplify the signal so it's only positive (with an op-amp) or i can feed it directly to the MCP3913?
 

The input spec is for AC .
So +1 and - 1 is AC maximum.
 

Hi,

The datasheet is very clearly in this.

"Absolute input voltage measured against AGND": -1V ....+1V
"Differential input voltage": -600mV/gain ... +600mV/gain (where gain is 1..32)

--> a 0.7V RMS signal will not kill the ADC, but it is out of range. Your ADC can not decode it.

Klaus
 

Yes you're right. As i read in the datasheet and from other sources the Max voltage in range is +-600mV so i decide to change my chip. I plan to use the LTC2348-16 from linear technology. I want to measure 6 channel, 5ksps minimum at each channel. I want to send them to PC either with PIC32MX USB or with UART with FTDI FT232H with a dsPIC30F4013. My problem is about buffering How much buffer i need? 5ksps*6 channel = 30000 results right? So as the results are 12-bit or 16-bit i need two bytes for each result 2*3000=60kbyte. Can i read and send the results directly to pc? Can i buffer some of the data and send them as packets of data or i have to buffer all the data each second and send them once a second on the pc? PIC32MX has 64kb RAM but the dsPIC30F has 2kb RAM.
 

Hi,

so i decide to change my chip
Why? Simply change the burden resistor of the ct...

My problem is about buffering How much buffer i need?
It depends on WHY you need the buffer.
If you just want to transmit the data to the PC, then maybe you don't need an extra buffer. FTDI has FIFO inside.

For sure you may use big buffers..but why. Send it as soon as possible. FTDI is easy to use. Even isochronous mode is possible.

Klaus
 

USB2 is a CPU polled isochronous stream of data with a maximum interruption determined by the number of background processes, prioirities and number of CPU cores for example.

Using LatencyMon reporting tool for Windows 7, Windows 8 / 8.1, and Windows 10
1.Close all programs
2.Download LatencyMon (free home edition) from www.resplendence.com/downloads < here.
3.Run the installer, and allow LatencyMon to install.
4.Ensure your PC has it's AC power supply connected, and you've completed all the steps from the PC Optimization Guide https://support.serato.com/hc/en-us/articles/203057850-PC-Optimization-Guide-for-Windows-8-1https://support.serato.com/hc/en-us/articles/203057850-PC-Optimization-Guide-for-Windows-8-1for Windows-8-1 article.

You can benchmark before and after changes and keep Restore Points.
Disable all useless Autoruns from the startup. Uninstall crapware.

Then you might get by with 10~20ms buffer, once the process is initialized. ( just a guess )
 
Last edited by a moderator:

Hi,
Why? Simply change the burden resistor of the ct...

Because it is seems very complex to me to interface with. The Vin range was just the trigger for the change. Anyway the change of chip isn't problem, i have them both (MCP3913 and LTC2348)

It depends on WHY you need the buffer.
If you just want to transmit the data to the PC, then maybe you don't need an extra buffer. FTDI has FIFO inside.

For sure you may use big buffers..but why. Send it as soon as possible. FTDI is easy to use. Even isochronous mode is possible.

Yes FT232H has 1kb buffer so i can store up to 500 results right? (as each result is 2 byte word)
I want to collect the digital data from ADC and send it immediately to PC. The calculation on the data will be done on PC side software. So with UART communication PIC-FTDI-PC can i be fast enough to transmit 60kb of data without buffering it anywhere on PIC?
 

The key is to make the PC fast enough in OS side background activities so that UART is fast enough in the foreground to prevent overflow regardless of how fast the data rate is. This also requires flow control in the UART and a FIFO in the external client. Then you need buffer overflow error recovery scripts to preserve integrity of the data with a limited synchronous buffer.

A fast PCI port card might be better than a USB serial port or a USB to parallel FIFO bidirectional data transfer interface chip like FT245R on your card.

Do the tests I suggested.
 
Last edited:

Hi,

With an FT245 I achieved 300kbytes/s. Many years ago. No high end processor, Win NT, Visual basic.

Lately we used a dual port FT2232H (mind the "H"). We achieved about 20Mbytes/s.
One port we used to communicate low speed with an AVR.
The other port we used for the high speed data communication
* from SRAM -> FPGA controlled -> FTDI -> PC (Linux)

Klaus
 

With a DSPIC33FJ32MC202 running on 39 MIPS i am using mplab x simulator to check about timing. I am setting UART baud rate to 750k baud. To send two bytes over UARTit takes about 27us. For me this is not acceptable, 27 us for one result?? (2 bytes). How about for 30000 results, 60 kb of data? Am i doing something wrong?

Below is my code:

Code:
// DSPIC33FJ32MC202 Configuration Bit Settings

// 'C' source line config statements

#include <xc.h>
#define FCY 39000000UL 
#include <libpic30.h>



// FBS
#pragma config BWRP = WRPROTECT_OFF     // Boot Segment Write Protect (Boot Segment may be written)
#pragma config BSS = NO_FLASH           // Boot Segment Program Flash Code Protection (No Boot program Flash segment)

// FGS
#pragma config GWRP = OFF               // General Code Segment Write Protect (User program memory is not write-protected)
#pragma config GSS = OFF                // General Segment Code Protection (User program memory is not code-protected)

// FOSCSEL
#pragma config FNOSC = FRC           // Oscillator Mode (Primary Oscillator (XT, HS, EC) w/ PLL)
//#pragma config IESO = ON                // Internal External Switch Over Mode (Start-up device with FRC, then automatically switch to user-selected oscillator source when ready)

// FOSC
#pragma config POSCMD = XT              // Primary Oscillator Source (XT Oscillator Mode)
#pragma config OSCIOFNC = OFF           // OSC2 Pin Function (OSC2 pin has clock out function)
#pragma config IOL1WAY = ON             // Peripheral Pin Select Configuration (Allow Only One Re-configuration)
#pragma config FCKSM = CSECMD           // Clock Switching and Monitor (Clock switching is enabled, Fail-Safe Clock Monitor is disabled)

// FWDT
#pragma config WDTPOST = PS32768        // Watchdog Timer Postscaler (1:32,768)
#pragma config WDTPRE = PR128           // WDT Prescaler (1:128)
#pragma config WINDIS = OFF             // Watchdog Timer Window (Watchdog Timer in Non-Window mode)
#pragma config FWDTEN = OFF             // Watchdog Timer Enable (Watchdog timer enabled/disabled by user software)

// FPOR
#pragma config FPWRT = PWR128           // POR Timer Value (128ms)
#pragma config ALTI2C = OFF             // Alternate I2C  pins (I2C mapped to SDA1/SCL1 pins)
#pragma config LPOL = ON                // Motor Control PWM Low Side Polarity bit (PWM module low side output pins have active-high output polarity)
#pragma config HPOL = ON                // Motor Control PWM High Side Polarity bit (PWM module high side output pins have active-high output polarity)
#pragma config PWMPIN = ON              // Motor Control PWM Module Pin Mode bit (PWM module pins controlled by PORT register at device Reset)

// FICD
#pragma config ICS = PGD1               // Comm Channel Select (Communicate on PGC1/EMUC1 and PGD1/EMUD1)
#pragma config JTAGEN = OFF             // JTAG Port Enable (JTAG is Disabled)

void OpenUART1();
char BusyUART1();
char BusyUART1();
void PrintStringUART1();
void WriteCharToUART1(unsigned char Data);

int main(void) {
    // Configure PLL prescaler, PLL postscaler, PLL divisor
    PLLFBD=37; // M = 39
    CLKDIVbits.PLLPOST = 0; // N2 = 2
    CLKDIVbits.PLLPRE = 0; // N1 = 2

    // Initiate Clock Switch to Primary Oscillator with PLL (NOSC = 0b011)
    __builtin_write_OSCCONH(0x03);
    __builtin_write_OSCCONL(0x01);

    // Wait for Clock switch to occur
    while (OSCCONbits.COSC != 0b011);

    // Wait for PLL to lock
    while(OSCCONbits.LOCK != 1);    

    TRISBbits.TRISB15=0;
    TRISBbits.TRISB14=1;
    
     __builtin_write_OSCCONL(OSCCON & 0xDF);        // to clear IOLOCK
     // Assign U1TX to RP15, Pin 26
     RPOR7bits.RP15R = 3;
    // Assign U1RX to RP14, Pin 25
    RPINR18bits.U1RXR = 14;
    __builtin_write_OSCCONL(OSCCON | 0x40);        // to set IOLOCK
    
    unsigned char count=1;

    OpenUART1();

    while(1) {

       //Time from here
       WriteCharToUART1(count);
       WriteCharToUART1(count);
       //To here = 27us according to mplab stopwatch
    }
    return 0;
}

void OpenUART1(void) {
    U1MODEbits.STSEL=0;
    U1MODEbits.PDSEL=0;
    U1MODEbits.ABAUD=0;
    U1MODEbits.BRGH=1;
    U1BRG=12;
    
    U1MODEbits.UARTEN=1;
    U1STAbits.UTXEN=1;
    
}

char BusyUART1(void) {
    if (!IFS0bits.U1TXIF) {
        return 1;
    }else {
        IFS0bits.U1TXIF=0;
        return 0;
    }
}

void PrintStringUART1(unsigned char *String) {
    while(*String) {
        WriteCharToUART1(*String++);
    }
}

void WriteCharToUART1(unsigned char Data) {
    U1TXREG=Data;
    while(BusyUART1());
}
 

Hi,

750kBaud.. = 750 kbits/s
10 bits/byte (including 1 start and 1 stop)
= 75kbytes/s

= 13.3us/byte = 26.7us/2bytes.

so your calculation is correct.

****
serial communication - especially with UART - often is the bottleneck.

therefore i used
* the FT245 with parallel interface
* or the FT2232H with two configurable interfaces (both can be parallel)

Klaus
 

Can i achive what i need with a PIC18F46K80 and FT232H CPU-style FIFO?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top