View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Apr 21, 2013 2:41 pm |
|
|
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: 19545
|
|
Posted: Mon Apr 22, 2013 1:16 am |
|
|
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
|
|
|
stinky
Joined: 05 Mar 2012 Posts: 99 Location: Central Illinois
|
|
Posted: Thu Apr 25, 2013 8:58 am |
|
|
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: 19545
|
|
Posted: Thu Apr 25, 2013 9:14 am |
|
|
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 |
|
|
|