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

Writing non-existing register, can I do that?

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



Joined: 17 Oct 2005
Posts: 98

View user's profile Send private message

Writing non-existing register, can I do that?
PostPosted: Mon Mar 17, 2008 7:30 am     Reply with quote

Hi,

I'm using a mix of PIC10F202 and PIC10F206. The difference between the 2 is that PIC10F206 has a comparator, and PIC10F202 doesn't.

I'm not using the comparator so in my PIC10F206 code I disable it. Can I somehow use the PIC10F206 code for the PIC10F202 too? Would it matter to write to a register not implemented in the PIC?

I was thinking of reading the register bit, and if it was set, then clear it. The bit is set at reset and powerup and I guess it would read as 0 on the chip where the register is not implemented (PIC10F202) ?

Hope you can help.


Regards,
Futterama
Ttelmah
Guest







PostPosted: Mon Mar 17, 2008 7:50 am     Reply with quote

Start by looking at the chips data sheet.
Look at Table 4-1.
Look in particular at Note5.
Except for this, there is no reason not to use the same code. If you ae not using this ability, no problem.
Then look at Figures 4-3, and 4-4. Note2.
The main control register, will simply read as '0' on the 202.

Best Wishes
Futterama



Joined: 17 Oct 2005
Posts: 98

View user's profile Send private message

PostPosted: Mon Mar 17, 2008 8:22 am     Reply with quote

Ttelmah, thanks, I wasn't able to find that information in the datasheet, but I guess I didn't look hard enough Rolling Eyes
Franck26



Joined: 29 Dec 2007
Posts: 122
Location: Ireland

View user's profile Send private message

PostPosted: Mon Mar 17, 2008 2:06 pm     Reply with quote

And what about something like:
Code:
#if device == PIC10F206
// code to write into the register
#endif


Franck.
Futterama



Joined: 17 Oct 2005
Posts: 98

View user's profile Send private message

PostPosted: Mon Mar 17, 2008 2:09 pm     Reply with quote

Franck26 wrote:
And what about something like:
Code:
#if device == PIC10F206
// code to write into the register
#endif


Franck.

Well, that will be run at compile time - I want to use the same .hex file for both devices.
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