View previous topic :: View next topic |
Author |
Message |
samyg
Joined: 26 Apr 2013 Posts: 11
|
Support for newer PIC16F1842x with new ADCC |
Posted: Wed Jun 20, 2018 7:02 am |
|
|
Hi,
I recently came across some very new PICs with a 12-bit ADC with computation (ADCC) module, which seems pretty decent as it can do a lot of common post-ADC operations without CPU intervention. I've got a few samples of these, but haven't found much online on how to use these new features using anything other than the instructions from the datasheet (in assembly -_-).
I was wondering if anyone here has worked with these parts and CCS? Does CCS have any new functions to support these? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
samyg
Joined: 26 Apr 2013 Posts: 11
|
|
Posted: Wed Jun 20, 2018 11:01 pm |
|
|
Thanks!
So the ADCC is supported, but I think the new parts I wrote about aren’t supported yet, maybe soon they will be.
Strange that I couldn’t find this info in the compiler manual though.
Cheers. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19553
|
|
Posted: Thu Jun 21, 2018 12:27 am |
|
|
Not really.
There are several different 'manuals', and they all lag the actual compiler.
There is the 'help' inside the compiler, the .chm manual, and the .pdf manual.
Then there is then the .h file for the chip itself. Several of the manual entries will say:
"The valid options vary depending on the device. See the devices .h file for all options.".
This last one is the one that is always the most 'up to date'. The .pdf is the one that lags the most. The F1 help is the other one that usually covers new features the quickest.
Now in this case the .h file is the key With the setup_adc function for the 16LF18876 for example in the include file we have:
Quote: |
_bif void setup_adc(int32 mode, int8 ADCRS, int8 ADRPT);
//Constants used for SETUP_ADC() first parameter are:
#define ADC_LEGACY_MODE
#define ADC_ACCUMULATE_MODE
#define ADC_AVERAGE_MODE
#define ADC_BURST_AVERAGE_MODE
#define ADC_LOW_PASS_FILTER_MODE
#define ADC_OFF
//and
// The second parameter for SETUP_ADC() is a value (0-5). For Accumulate,
// Average and Burst Average modes it sets how much the accumulated value
// is divided by (2^ADCRS). For Low-pass Filter mode it sets the cut-off
// frequency of the filter (see Table 23-4 in device's datasheet). Not
// used for Legacy mode.
// The third parameter for SETUP_ADC() is a value (0-255). For Average, Burst
// Average and Low-pass Filter modes it sets the number of samples to be done
// before performing a threshold comparison. Additionally for Burst Average
// mode it sets the number of times that the ADC module will retrigger its self.
// Not used in Legacy or Accumulate modes.
// Constants returned from ADC_STATUS are:
#define ADC_OVERFLOWED
#define ADC_GT_UPPER_THRESHOLD
#define ADC_LT_LOWER_THRESHOLD
#define ADC_UPDATING
//Bits 2-0 are multistage status bits, see Register 23-5: ADCSTAT in
//device's datasheet for details (ignore other bits).
|
Now these have the values trimmed and some parts removed, but you can see that this is telling you that setup_adc now supports three parameters, and tells you what these are. ADC_STATUS also supports telling us a lot more about what the unit is doing.
Currently support is available for the following chips (with the current compiler):
18F57K42
18F47K42
18F27K42
18F67K40
18F66K40
18F65K40
18F56K42
18F55K42
18F47K40
18F46K42
18F46K40
18F45K40
18F27K40
18F26K42
18F26K40
18F25K42
18F25K40
18F24K42
18F25K40
16F19197
16F19195
16F19196
16F19186
16F19176
16F19175
16F19156
16F19155
16F18877
16F18875
16F18876
16F18857
16F18856
16F18855
16F18854 (and their LF variants)
Annoyingly CCS used to update the file 'readme.txt' with the compiler to note new functions before they were added to the manual, but for several versions now this has not been happening. This is a real pity, since it was very nice to be able to glance at this and say 'oh, they have added a new parameter to this function - will investigate'.... :(
The '16F184xx' variants are the only ones CCS haven't yet added support for. Ask them. They'll probably do you an updated .dat file to support these. It'll almost certainly be in the next compiler release. Problem is that MicroChip are launching stuff so fast, that keeping up is at times hard!... |
|
|
samyg
Joined: 26 Apr 2013 Posts: 11
|
|
Posted: Thu Jun 21, 2018 1:05 am |
|
|
Thanks Ttelmah.
I do usually use the .h file for referring to specific chip functions as that is the most reliable, but never knew that the PDF is lagging behind.
I looked for the 16f18424.h file in the devices folder but with no luck, as you said, it isn't supported yet. Shame, because I was pretty excited to use the 12-bit ADCC! I guess I'll just have to wait it out for a few weeks. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19553
|
|
Posted: Thu Jun 21, 2018 1:11 am |
|
|
As I said, just ask them. Since they have the functions already implemented, you only need the .dat file and the .h file. They will usually do you a 'beta' of these, very quickly, and it may even trigger a new compiler release. |
|
|
samyg
Joined: 26 Apr 2013 Posts: 11
|
|
Posted: Thu Jun 21, 2018 1:21 am |
|
|
Will do so, thanks! |
|
|
|