Bug: ADC 16F1933,16F1934,16F1936,16F1937 & 16F1939 [SOLVED]
Posted: Sat Feb 14, 2015 1:40 pm
Using V6.1.1.0:
ADC does not obtain correct value from any of the channels (Tested with 16F1937)
For example using GetByte on AN1.
If ADC is supposed to be 200 when working correctly, then with the bug the readings I was getting:
etc
After investigation I found it's not a bug with Flowcode, but a bug within boostC header files PIC16F19xx.h
There is a define for both adres and adresl for the same address:
Therefore the ADC conversion is being done as though there is an adres register within 16F1937 and there is not.
Attached is an unofficial fix if anyone is stuck with ADC conversion because of this bug.
If you make a backup copy and replace:
PIC_CAL_ADC.c that's in:
C:\Program Files (x86)\Flowcode 6\CAL\PIC (If 64 bit windows)
or
C:\Program Files\Flowcode 6\CAL\PIC(If 32 bit windows.)
With the attached file, then ADC should read correct values allowing for BoostC bug.
I thought I would modify Flowcode file rather than Boostc header files since if there is a V6 update then we could be back to square1
Although that may not be the case as I don't know the bug correction process if there is a bug with BoostC
Martin
Edit: Official fix within link Leigh posted below
ADC does not obtain correct value from any of the channels (Tested with 16F1937)
For example using GetByte on AN1.
If ADC is supposed to be 200 when working correctly, then with the bug the readings I was getting:
Code: Select all
0
64
0
128
0
64
0
128After investigation I found it's not a bug with Flowcode, but a bug within boostC header files PIC16F19xx.h
There is a define for both adres and adresl for the same address:
Code: Select all
#define ADRES 0x009B
#define ADRESL 0x009B Attached is an unofficial fix if anyone is stuck with ADC conversion because of this bug.
If you make a backup copy and replace:
PIC_CAL_ADC.c that's in:
C:\Program Files (x86)\Flowcode 6\CAL\PIC (If 64 bit windows)
or
C:\Program Files\Flowcode 6\CAL\PIC(If 32 bit windows.)
With the attached file, then ADC should read correct values allowing for BoostC bug.
I thought I would modify Flowcode file rather than Boostc header files since if there is a V6 update then we could be back to square1
Although that may not be the case as I don't know the bug correction process if there is a bug with BoostC
Martin
Edit: Official fix within link Leigh posted below