Page 1 of 2
dsPIC sYNCHRONISING 2 A/D Channels
Posted: Wed Mar 17, 2021 9:29 am
by DAVIDJOINER
Hi
I am using a dsPIC ECIO and 2 EB085 A/D boards
I understand how to read these channels in normally using your component but i wish to synchronise the A/D inputs ie read both at same time point
I require to sample at around 20k not too fast for the chips (100k) so i am sure it can be done
Any ideas
David
Re: dsPIC sYNCHRONISING 2 A/D Channels
Posted: Wed Mar 17, 2021 9:59 am
by BenR
Hi David,
I've not tested this on hardware but this should hopefully do what you need, or at least show you the way.
Re: dsPIC sYNCHRONISING 2 A/D Channels
Posted: Wed Mar 17, 2021 10:35 am
by DAVIDJOINER
Hi Ben
That's great
Understand your logic and will try out on the hardware later this week
Many thanks
David
Re: dsPIC sYNCHRONISING 2 A/D Channels
Posted: Thu Mar 18, 2021 3:35 pm
by DAVIDJOINER
Hi Ben
I tried your idea today
Does not appear to work (Note i am injecting 1khz into the EB805 card)
However if i disable your loop and enable the normal EB085 component i get the 1Kz tone out of the EB086 so the rest of the setup appears to be working okay
Note i am currently only using 1 EB085 for test purposes so i have // the 2nd EB085 in the c code
Any further ideas
David
Re: dsPIC sYNCHRONISING 2 A/D Channels
Posted: Thu Mar 18, 2021 4:59 pm
by BenR
Hi David,
I got the upper and lower bytes reversed, Please can you try this instead and hopefully it will work better.
Re: dsPIC sYNCHRONISING 2 A/D Channels
Posted: Thu Mar 18, 2021 6:20 pm
by DAVIDJOINER
Ben
Great now works fine on the single EB085 configuration i tested
Will try with 2 EB085's configuration next week
Many thanks for fast response
Excellent service as usual
David
Re: dsPIC sYNCHRONISING 2 A/D Channels
Posted: Sun Mar 21, 2021 4:43 pm
by DAVIDJOINER
Ben
Tried the second A/D converter in hardware that works fine in synchronising and i can output each to the EB086 output as required
However when i try to add the 2 waveforms together using the DSP Math + funcion i have a problem
It only appears to see input on the A channel
It does not appear to see any input i put into the B channel
Can you check the math + function
I do note that in the simulation mode it does appear to see both A & B inputs if i use the sinewave generator to test it
Any ideas
David
Re: dsPIC sYNCHRONISING 2 A/D Channels
Posted: Mon Mar 22, 2021 10:56 am
by BenR
Hi David,
I can't see anything incorrect in the code generation of the math function. It seems to be working correctly.
I wonder if there is a gain problem or something similar on the channel B input hardware?
The generated code looks like this.
DSPBuff_6_Put(FCV_05d31_DSP_Math1__INDEXOUT, DSP_Math1_Ref1_Get(FCV_05d31_DSP_Math1__INDEXA) + DSP_Math1_Ref2_Get(FCV_05d31_DSP_Math1__INDEXB));
which boils down to
MathBuffer[0] = DSPInput1[0] + DSPInput2[0];
Re: dsPIC sYNCHRONISING 2 A/D Channels
Posted: Mon Mar 22, 2021 1:19 pm
by DAVIDJOINER
Ben
I had already tried that ie I fed the same channel to A & B seperately and even the same channel to both A & B at the same time and in all cases the input on the B channel had no affect on the output ?
David
Re: dsPIC sYNCHRONISING 2 A/D Channels
Posted: Tue Mar 23, 2021 12:01 pm
by BenR
Hi David,
Many thanks for chasing this one, I've replicated the problem and beleive I have now spotted the issue and am in the process of a fix. Hopefully I'll have one for you shortly. I beleive it's a case of a semi colon in the wrong place ending the command too early before the B input gets added.