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.

sampling adc data on psoc

Status
Not open for further replies.

milinds.747

Newbie level 3
Joined
Mar 7, 2017
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
32
I am making an oscilloscope using Cypress PSoC 3. The sample data is sent to the computer and plotted. The ADC is used in single ended configuration. Whenever I connect the signal generator to the board, it throws a lot of garbage values to the UART. On the signal generator, the amplitude set is 1Vpp with 1V dc offset at a frequency of 100Hz. The frame received looks something like this $18 18 18 18 18 18 18 18 18 18%. This problem did not occur when I tried connecting a DC power supply. When I read the component data sheet, it mentioned obtaining a 16 bit result for 8 bit resolution to avoid wrap around. When I obtained 16 bit result, I got 277 instead of 18. The peak amplitude applied is 1.5V, so the sample value that should be obtained is 191 or below from the ADC. This problem occurs irrespective of the input waveform, sine, square or triangular. I tried using a different kit and a different function generator. Futile.

The problem is: The ADC does not send proper sample values of the input signal on connecting a signal generator.
 

Hi,

a lot of informations missing:
* ADC sample rate
* bit resolution of your ADC
* analog input voltage range of the ADC

Klaus
 

Hi,

a lot of informations missing:
* ADC sample rate
* bit resolution of your ADC
* analog input voltage range of the ADC

Klaus

ADC sampling Rate = 1,00,000
Resolution = 8 bits
Input Voltage Range = 0 to 2V
 

Hi,

please clarify sampling rate: 100kS/s or 1MS/s?

Now the values make sense.
Did you check ADC_input_pin_voltage with a scope? (Directely at the IC_pin)

Could you show schematic and code?

Klaus.
 

Hi,

please clarify sampling rate: 100kS/s or 1MS/s?

Now the values make sense.
Did you check ADC_input_pin_voltage with a scope? (Directely at the IC_pin)

Could you show schematic and code?

Klaus.

100kS/s is the sampling rate.

Code:

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <project.h>
#include "stdio.h"
 
int i = 0;
uint8 i_arr[10];
uint8 tx = 0;
 
int main()
{
    CyGlobalIntEnable; // Enable global interrupts
    UART_Start();
    ADC_Start();
    ADC_StartConvert(); 
    while(1)
    {
        //obtain 10 values from adc and store into an array
        for(i = 0; i < 10; i++)
        {
            if(ADC_IsEndConversion(ADC_WAIT_FOR_RESULT))
                i_arr[i] = ADC_GetResult8();
        }
        
        //start byte
        UART_PutChar('$');
        
        //convert the values into ascii and transmit them, one by one
        for(i = 0; i < 10; i++)
        {
            tx = i_arr[i];
            UART_PutChar(tx/100 + 0x30);
            tx %= 100;
            UART_PutChar(tx/10 + 0x30);
            tx %= 10;
            UART_PutChar(tx + 0x30);
            //insert space to identify two seperate numbers
            if (i != 9)
                UART_PutChar(' ');
        }
        
        //stop byte
        UART_PutChar('%');
        
        //indication to move on to next frame
        UART_PutChar('\n');
    }
}



- - - Updated - - -

https://obrazki.elektroda.pl/1600195300_1489029921.png
 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top