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 CCS Technical Support

PIC10F202 Pull-up & Wake on Pin Change

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



Joined: 14 Jul 2004
Posts: 11

View user's profile Send private message

PIC10F202 Pull-up & Wake on Pin Change
PostPosted: Fri Jun 02, 2006 3:41 am     Reply with quote

Hi,

I feel the answer is simple, but somehow can�t figure it out!

The datasheet for PIC10F202 does not show the OPTION register address so I can�t use the #byte to access the register bits. Then how to enable weak pull up on input pins and also how to enable wake up from sleep on pin change (from pull up to ground)? I need to enable both at the same time for all input pins.

The CCS project wizard does generate the C source to use the built in command port_b_pullups (TRUE); but it shows Undefined identifier error on this command when compiling.

Also, the datasheet shows that the OPTIONS register (with N/A address) revert back to default settings on Reset (which is disable weak pull ups and wake from sleep on pin change)? Does this mean that when the PIC wakes up is actually reset rather than continuing to the next line after Sleep?

Thanx for any help.

Sorry, i forgot to metion that i am using version 3.236
Ttelmah
Guest







PostPosted: Fri Jun 02, 2006 4:48 am     Reply with quote

If you look at the manual for 'port_b_pullups', you will see an entry, where it says "For PCM & PCH only, for PCB, use 'setup_counters'". Now the reason for this is hardware. On the 'PCB' chips (10, and 12), the pullups are controlled by a bit in the option register, and this is accessed by the 'setup couners' command.
If you use:
setup_counters(RTCC_INTERNAL,0);

The pullups will be enabled. Substitute the required prescaler etc., for the first value. If you want the counters disabled, substitute 'DISABLE_PULLUPS' for the second value.
If you look at the listing generated by this command, you will see it performs the 'option' command.

Best Wishes
RatherBeFlying



Joined: 14 Jul 2004
Posts: 11

View user's profile Send private message

PostPosted: Fri Jun 02, 2006 12:18 pm     Reply with quote

Thanx Ttelmah, we live and learn.

So if i need wake up on pin change as well then another setup counter call should be made?

What do you think if i just use the following just before entering the while(1) loop and change the byte value in W to be the entire OPTION register setting?

Code:

#asm
MOVELW 0
OPTION
#endasm


Thanx again.
RatherBeFlying



Joined: 14 Jul 2004
Posts: 11

View user's profile Send private message

PostPosted: Sat Jun 03, 2006 11:45 am     Reply with quote

Anyone successfully compiled PIC10F20x on CCS?

Strange problems occurring, with a search on the forum, a Configuration word problem could still be the issue as in:
http://www.ccsinfo.com/forum/viewtopic.php?t=22709

The end of my Hex file is

:060120004604800A030002
:021FFE00EB0FE7
:00000001FF
;PIC10F202

Shouldn�t that be 07FE as explain in the thread?

Thanx.
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