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

Problem with 10F200

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



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Apr 21, 2013 2:41 pm     Reply with quote

If you want pin GP2 (PIN_B2) to be an i/o pin, you need to clear the
T0CS bit in the OPTION register. See the example below:
Code:

#include <10F200.h>
#fuses NOWDT, NOMCLR
#use delay(clock=4M)

#define set_options(value)   {#ASM         \
                              MOVLW  value \
                              OPTION       \
                              #ENDASM}
//==========================================
void main()
{
set_options(0xDF);

while(1);
}
Ttelmah



Joined: 11 Mar 2010
Posts: 19433

View user's profile Send private message

PostPosted: Mon Apr 22, 2013 1:16 am     Reply with quote

The compiler does that for you, unless you have an old version.

Code:

.................... void main()
.................... {
0002:  MOVLW  DF
0003:  OPTION

First two lines of the generated assembler.

The poster hasn't said what compiler version they have. I'd suspect a rather old one....

Best Wishes
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Wed Apr 24, 2013 10:30 am     Reply with quote

My CCS is v4.134. Here is my schematic: http://dox.bg/files/dw?a=7b11e5b117
Do I have a mistake in it?
stinky



Joined: 05 Mar 2012
Posts: 99
Location: Central Illinois

View user's profile Send private message

PostPosted: Thu Apr 25, 2013 8:58 am     Reply with quote

Try adding a 0.1uf decoupling capp to the VDD line of the pic?
I've been bit in the butt by that causing odd behavior.

Also, my compiler version doesn't support this part so I cannot confirm, but does
Code:
#use delay(clock=4M)

produce the desired setting? Your schematic doesn't show an external crystal so I'd assume you want the internal r/c setting.
Ttelmah



Joined: 11 Mar 2010
Posts: 19433

View user's profile Send private message

PostPosted: Thu Apr 25, 2013 9:14 am     Reply with quote

The 10F20x chips _only_ operate with the internal oscillator. To save pins. Quote from data sheet:

"The PIC10F200/202/204/206 devices are offered with
Internal Oscillator mode only."

Makes oscillator selection rather easy!....

No possibility of an external crystal.

Agree wholeheartedly on the capacitor. Strange behaviours of all sorts can result if there is not adequate decoupling. Also don't think 'bigger is better' here, and say 'got 470uF on the supply'. Needs to be a capacitor with good HF performance (most electrolytic's do not have good HF perfromance), close to the chip.

Best Wishes
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