View previous topic :: View next topic |
Author |
Message |
bkamen
Joined: 07 Jan 2004 Posts: 1611 Location: Central Illinois, USA
|
setup_vref writes to wrong register on PIC24FJ64GA102 |
Posted: Mon Jan 07, 2013 3:38 pm |
|
|
Hey all,
Just for note... I was playing with the comparators on a PIC24FJ64GA102 and noticed that setup-vref seems to write to the wrong register. (0x632 instead of 0x652)
Unless it's just a database bug.. which I doubt since getenv returns the right value.
Anyway -- try it for yourself.. maybe I just haven't been playing with the PIC24's enough lately.
-Ben
Compiler is PCD 4.140
Code: |
#include <24fj64ga102.h>
#use delay(clock=32M, int=8M)
#fuses NOJTAG, NOPROTECT
#fuses FRC_PLL, NOIESO, ICSP2
#word CVRCON = getenv("sfr:CVRCON") // test database's register entries. Seems to be ok when .LST is checked.
// ===============================================================================
void main (void) {
setup_vref( 0x0040 | VREF_ANALOG | VREF_HIGH | 1);
CVRCON = 0x00C0 | VREF_LOW | 7;
} |
_________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19387
|
|
Posted: Tue Jan 08, 2013 2:24 am |
|
|
Yes, totally stupid. Have a database of chip data, then write your own code without using it. Minus one out of ten....
It's wrong for the whole of this section of the family (the 104 as well).
What is interesting, is that the used address is correct on the larger chips (24fj128ga106). On this family, CVRCON is at address 632, and here getenv, and what the code do 'agree'. I'd suspect they are actually doing something like referencing the address used to another register, and this particular chip family use a different setup to this.
Report it to CCS.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
bkamen
Joined: 07 Jan 2004 Posts: 1611 Location: Central Illinois, USA
|
|
Posted: Tue Jan 08, 2013 11:09 am |
|
|
Ttelmah wrote: |
Report it to CCS.
|
I did that before I posted it here.
heheheh...
Cheers,
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
![](templates/subSilver/images/spacer.gif) |
|