CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

setup_vref writes to wrong register on PIC24FJ64GA102

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

setup_vref writes to wrong register on PIC24FJ64GA102
PostPosted: Mon Jan 07, 2013 3:38 pm     Reply with quote

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
Ttelmah



Joined: 11 Mar 2010
Posts: 19388

View user's profile Send private message

PostPosted: Tue Jan 08, 2013 2:24 am     Reply with quote

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
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Tue Jan 08, 2013 11:09 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group