Sir I am trying to move my project from 8 bit pic (16F1719) to 16 bit dsPIC33EV. I want to use the simultaneous sampling 10-bit ADC mode in the dsPIC33EV for my ADC function. The only option offered on component is12 bit one by one function.
Is it possible to build a component using the 10-bit function for this dsPIC33EV or do I need to drop into C and set AD128 flag to "0" and any other Flags.
The problem with this is I cannot see this in simulation and it would deter me from porting my project to a faster chip before I invest time in building the hardware. The chip needs to be 5V and supported by Flowcode 11.
The only other option would be to read at 12 bits, one by one and convert to 10 bits. Thus, keeping the hardware DAC at 10 bits on the chance I can finally move to simultaneous sampling.
Is it possible to have the bit option 10/12 in the ADC component for this chip with simultaneous function or is this only possible in C ?
Thank you
simultaneous sampling 10-bit ADC mode dsPIC33EV
-
rsbake24ja
- Posts: 8
- http://meble-kuchenne.info.pl
- Joined: Fri Dec 18, 2020 4:14 am
-
Steve-Matrix
- Matrix Staff
- Posts: 1896
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 278 times
- Been thanked: 445 times
Re: simultaneous sampling 10-bit ADC mode dsPIC33EV
I'm not too familiar with ADC sampling on that particular chip, so bear that in mind and hopefully others will have a better answer.
If it were me, I would first read at 12 bits and see if the speed is acceptable. It's probably not much of a difference to the speed, and there could be greater savings with other C or ASM optimisations anyway.
If you need to convert to 10 bits, then I assume you are reading the raw data. In that case, converting each value to 10 bits should be trivial. Probably by right-shifting the value 2 places (using the >> operator).
That said, it could be that the micros present the adc values as a 16-bit result, with the lower 4 (or 6) bits set to zero in 12-bit (or 10-bit) mode. If this is so, then you will not need to do any manipulation of the value (unless you want to ignore the higher accuracy by masking off some lower bits).
If it were me, I would first read at 12 bits and see if the speed is acceptable. It's probably not much of a difference to the speed, and there could be greater savings with other C or ASM optimisations anyway.
If you need to convert to 10 bits, then I assume you are reading the raw data. In that case, converting each value to 10 bits should be trivial. Probably by right-shifting the value 2 places (using the >> operator).
That said, it could be that the micros present the adc values as a 16-bit result, with the lower 4 (or 6) bits set to zero in 12-bit (or 10-bit) mode. If this is so, then you will not need to do any manipulation of the value (unless you want to ignore the higher accuracy by masking off some lower bits).