Hi Ben
A while back you kindly generated a small routine to allow 2 EB085 boards to scan and take a sample at the same time ie synchronously which worked fine
Is there any chance you can do a routine doing the same functionality but this time using 2 of the A/D channels on the EB0082 rather than the EB085 boards
Best regards
David
A/D synchronised sampling on 2 channels using BL0032
-
- Posts: 140
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 02, 2020 7:35 pm
- Been thanked: 18 times
-
- Matrix Staff
- Posts: 1952
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 510 times
- Been thanked: 698 times
Re: A/D synchronised sampling on 2 channels using BL0082
Hi David,
The EB082 is a product code for a simple converter board that never went into production, is this the right code?
The EB082 is a product code for a simple converter board that never went into production, is this the right code?
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 140
- Joined: Wed Dec 02, 2020 7:35 pm
- Been thanked: 18 times
Re: A/D synchronised sampling on 2 channels using BL0082
Hi Ben
Please ignore references to BL0082 and EB0082
I actually meant to say using 2 of the A/D channels on BL0032 ie the dspic board
David
Please ignore references to BL0082 and EB0082
I actually meant to say using 2 of the A/D channels on BL0032 ie the dspic board
David
-
- Matrix Staff
- Posts: 1952
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 510 times
- Been thanked: 698 times
Re: A/D synchronised sampling on 2 channels using BL0082
Hi David,
Here is a simple example that uses a timer interrupt to set the sample rate. Every time the interrupt happens we sample ADC channels 0 and 1 one after another and store the results into circular buffers.
Here is the same example but this time we use the fact that the BL0032 has two ADC modules onboard to allow us to take both samples at approximatley the same time. Please note this should work fine as long as you are not using ADC inputs anywhere else in your program.
Here is a simple example that uses a timer interrupt to set the sample rate. Every time the interrupt happens we sample ADC channels 0 and 1 one after another and store the results into circular buffers.
Here is the same example but this time we use the fact that the BL0032 has two ADC modules onboard to allow us to take both samples at approximatley the same time. Please note this should work fine as long as you are not using ADC inputs anywhere else in your program.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 140
- Joined: Wed Dec 02, 2020 7:35 pm
- Been thanked: 18 times
Re: A/D synchronised sampling on 2 channels using BL0032
Hi Ben
Thanks for prompt reply
Your second example looks exactly what i am looking for thanks
Only have one more question roughly what do you think the difference in the sample point start time will
be between the 2 channels when using the BL0032 .
As i really need to have minimal phase difference possible
Best Regards
David
Thanks for prompt reply
Your second example looks exactly what i am looking for thanks
Only have one more question roughly what do you think the difference in the sample point start time will
be between the 2 channels when using the BL0032 .
As i really need to have minimal phase difference possible
Best Regards
David
-
- Posts: 140
- Joined: Wed Dec 02, 2020 7:35 pm
- Been thanked: 18 times
Re: A/D synchronised sampling on 2 channels using BL0032
Hi Ben
I tried compiling the advance example file but it would not compile correctly, have enclosed the compile report for info
Note your simple example does however compile correctly
David
I tried compiling the advance example file but it would not compile correctly, have enclosed the compile report for info
Note your simple example does however compile correctly
David
- Attachments
-
- ADC_Sampling_Advanced.msg.txt
- (1.6 KiB) Downloaded 501 times
-
- Matrix Staff
- Posts: 1952
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 510 times
- Been thanked: 698 times
Re: A/D synchronised sampling on 2 channels using BL0032
Hi David,
Aha thanks for letting us know, I'll get that fixed. Yes the second analogue peripheral only supports 10-bit sampling.
I've fixed it now and AD1 will use 12-bit sampling and AD2 will use 10-bit sampling.
Would you want AD1 on 12-bit and AD2 on 10-bit or both on 10-bit?
If you want 10-bit on both then open the file here in a text editor.
C:\ProgramData\MatrixTSL\FlowcodeV9\CAL\PIC16BIT\PIC16BIT_CAL_ADC.c
Goto line 1947.
And change to this
Aha thanks for letting us know, I'll get that fixed. Yes the second analogue peripheral only supports 10-bit sampling.
I've fixed it now and AD1 will use 12-bit sampling and AD2 will use 10-bit sampling.
Would you want AD1 on 12-bit and AD2 on 10-bit or both on 10-bit?
If you want 10-bit on both then open the file here in a text editor.
C:\ProgramData\MatrixTSL\FlowcodeV9\CAL\PIC16BIT\PIC16BIT_CAL_ADC.c
Goto line 1947.
Code: Select all
AD1CON1bits.AD12B = 1; //12bit sampling
Code: Select all
AD1CON1bits.AD12B = 0; //10bit sampling
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 140
- Joined: Wed Dec 02, 2020 7:35 pm
- Been thanked: 18 times
Re: A/D synchronised sampling on 2 channels using BL0032
Hi Ben
Yes both must be same so have set AD1 TO 10 BITS as you advised
Loaded new Cal and getting nearer but still an error in compile enclosed file (Also same error if keep AD1 to 12 bits)
David
Yes both must be same so have set AD1 TO 10 BITS as you advised
Loaded new Cal and getting nearer but still an error in compile enclosed file (Also same error if keep AD1 to 12 bits)
David
- Attachments
-
- ADC_Sampling_Advanced.msg.txt
- (1.58 KiB) Downloaded 678 times
-
- Matrix Staff
- Posts: 1952
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 510 times
- Been thanked: 698 times
Re: A/D synchronised sampling on 2 channels using BL0032
Hi David,
Hmm that's interesting. Maybe just try commenting out or removing this section on line 1978.
Hmm that's interesting. Maybe just try commenting out or removing this section on line 1978.
Code: Select all
#ifdef (_AD2CON1_AD12B_POSITION)
AD2CON1bits.AD12B = 1; //12bit sampling
#endif
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 140
- Joined: Wed Dec 02, 2020 7:35 pm
- Been thanked: 18 times
Re: A/D synchronised sampling on 2 channels using BL0032
Hi Ben
Thanks
That fix has now sorted the compilation issue
I will be testing the code next week in my application and hopefully it will all now work
Best regards
David
Thanks
That fix has now sorted the compilation issue
I will be testing the code next week in my application and hopefully it will all now work
Best regards
David