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.

[PIC] dspic30f ADC simultaneous sampling

Status
Not open for further replies.

Ancy Muhammed

Newbie level 2
Joined
Jun 8, 2015
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
29
I have to read 8 ADC channels. For this I selected simultaneous sampling of 4 channels. But I got the reading greater than the expected value for all channels. Almost 100 digit difference are observed. If I change to sequential sampling by selecting SIMSAM bit 0, I got the correct value.

The ADC settings are given below


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
ADCON1bits.ADON = 0; // A/D converter is off
ADCON1bits.ADSIDL = 0; // Continue module operation in Idle mode
ADCON1bits.FORM = 0b00; // Data output format is integer
ADCON1bits.SSRC = 0b011; // Motor Control PWM interval ends sampling and starts conversion
ADCON1bits.SIMSAM = 1; // Samples CH0, CH1, CH2, CH3 simultaneously
ADCON1bits.ASAM = 1; // Sampling begins immediately after last conversion completes
ADCON2bits.VCFG = 0b000; // Voltage Reference Configuration bits A/DVREFH = AVdd, A/DVREFL = AVSS
ADCON2bits.CSCNA = 0; // Do not scan inputs
ADCON2bits.CHPS = 0b11; // Converts CH0, CH1, CH2 and CH3
ADCON2bits.SMPI = 0b0001; // Interrupts at the completion of conversion for each 2nd sample/convert sequence
ADCON2bits.ALTS = 1; /* Uses MUX A input multiplexer settings for first sample, then alternate between MUX B and MUX A input
multiplexer settings for all subsequent samples */
ADCON3bits.SAMC = 0b01100; // Auto-Sample Time bits 12TAD
ADCON3bits.ADCS = 0b00011; // A/D Conversion Clock Select bits 4TCY
// MUX A Multiplexer Setting bits
ADCHSbits.CH123NA = 0b00; // CH1, CH2, CH3 negative input is VREF
ADCHSbits.CH123SA = 1; // CH1 positive input is AN3, CH2 positive input is AN4, CH3 positive input is AN5
ADCHSbits.CH0NA = 0; // Channel 0 negative input is VREF
ADCHSbits.CH0SA = 0b0010; // Channel 0 positive input is AN2
// MUX B Multiplexer Setting bits
ADCHSbits.CH123NB = 0b11; // CH1 negative input is AN9, CH2 negative input is AN10, CH3 negative input is AN11
ADCHSbits.CH123SB = 1; // CH1 positive input is AN3, CH2 positive input is AN4, CH3 positive input is AN5
ADCHSbits.CH0NB = 0; // Channel 0 negative input is VREF
ADCHSbits.CH0SB = 0b1000; // Channel 0 positive input is AN8
 
ADPCFG = 0xF8C3; // Analog Input Pin Configuration Control bits
ADCSSL = 0x0000; // Skip ANx for input scan
IFS0bits.ADIF = 0; // Clear ADC interrupt flag
IPC2bits.ADIP = 0b101; // ADC interrupt priority is 5

Could you please check the above issue. The ADC reading is made synchronised with PWM
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
19,450
Helped
4,300
Reputation
8,605
Reaction score
4,260
Trophy points
1,393
Activity points
128,993
Hi,

using VCC as reference....
Are you sure it is stable enough, free of noise, filtered?

It seems you built a motor control with PWM. Then there are high power pulses. I recommend to start conversion at a dedicated point of PWM. Then the values schould be stable and reliable.

Do you have a picture of your circuit / PCB layout. Especially power circuit and ADC circuit?
Can you show us your schematic?

Klaus
 

Ancy Muhammed

Newbie level 2
Joined
Jun 8, 2015
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
29
Hi,
Thanks for the reply

VCC is stable. Now i am not connected motor. I changed the point at which conversion starts. But I got the same observation as before.

Could you please check once more
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top