PDA

View Full Version : Configuring the GPIO.3/MCLR Pin



CocaColaKid
- 28th July 2004, 20:12
What would the command be to configure the 12F675 to use the GPIO.3 pin as an input all the time. The programmer keeps defaulting back to MCLR.

Dwayne
- 28th July 2004, 20:27
Hello CocoaColaKid,

CCK>What would the command be to configure the 12F675 to use the GPIO.3 pin as an input all the time. The programmer keeps defaulting back to MCLR.<<

There is no command. BUT! on your source code for your compiler you can put the command...to make sure your programmer keeps it to "input". PUt it at the top of your program.


@ DEVICE PIC12F675,MCLR_OFF or..
@ DEVICE PIC12F675,MCLR_ON. Which ever way you want.

If you look in the INC file of the 12F675, you can see all the control switches...

Doing this will take a little extra room in your file, but hey...its worth it to me.

This is also in the FAQ Section too.

Dwayne

CocaColaKid
- 28th July 2004, 20:36
Thanks Dwayne, I knew it would be something like that or actually I thought it would be a register.

Dwayne
- 28th July 2004, 20:40
Hello CocaColaKid,

CCK>Thanks Dwayne, I knew it would be something like that or actually I thought it would be a register.<<

You are very welcome. Enjoy yourself, and hope your project gets done like it is supposed to!


Dwayne

CocaColaKid
- 28th July 2004, 21:08
Dwayne,

Can I leave this pin open or do I have to tie it somewhere? I would like to be able to minimize my part count and it seems that if I don't use a resistor pulled high I get mixed results. If I tie it to the Vdd it works great. Any ideas?

Also, would the internal pull up resistors have enough umf to work for a pull up on a Dallas DS1820? Again trying to minimize part count.

Dwayne
- 29th July 2004, 15:33
Hello CocaColaKid,

CCK>>Can I leave this pin open or do I have to tie it somewhere? I would like to be able to minimize my part count and it seems that if I don't use a resistor pulled high I get mixed results. If I tie it to the Vdd it works great. Any ideas?<<

I always have the MCLR set as a input, and have had no problem. If it is set as a MCLR, you chip may or maynot work, depending on how you touch it... or things around it <g>. For a guarntee work, use a pull-up resister if you set it to MCLR instead of Input.

Some folks will go as far as putting a Pull-up there anyhow...I say try it... and if necessary do it.

CCK>>Also, would the internal pull up resistors have enough umf to work for a pull up on a Dallas DS1820? Again trying to minimize part count<<

I have not used a DS1820, but my guess, is that they do have enough Umph. I try to use the Internal Pullups whenever I can... I am like you.... the fewer the parts the better.

Dwayne

CocaColaKid
- 29th July 2004, 20:55
It's strange that you say this because these are the results that I am running into. Even if I configure the port as an input it still take forever to start up. Then when it does start I get random characters being injected into the serial output of the problem. If I drop a 4.7k resistor between it and +5V everything works great. I'm just now wondering if I ground it instead what the results would be? I'll have to try that and find out.

Dwayne
- 29th July 2004, 21:12
Hello CocaColaKid,

CCK>>It's strange that you say this because these are the results that I am running into. Even if I configure the port as an input it still take forever to start up.<<

Humm....It should be singing Dixie...

CCK>> Then when it does start I get random characters being injected into the serial output of the problem. <<

Ok, you may have a sync problem there. You may want to send a few nulls. to the serial to sync up the communication.

CCK>>If I drop a 4.7k resistor between it and +5V everything works great.<<

is your chip being turned on from 5 volts on another pin??? That 675 can run without the VCC connected up, and another pin connected to 5 volts.


Dwayne

CocaColaKid
- 30th July 2004, 13:09
>>Ok, you may have a sync problem there. You may want to send a few nulls. to the serial to sync up the communication.

I'm not sure what you mean here. The serial line is:

serout2 gpio.0,16780,["TEMP=",s2,dec3 temp/10,".",dec1 temp//10,223,"C "]

This is tied to a backpack LCD so I can see what is happening. When the MCLR is tied to the rail it works flawless. Remove the resistor and get mixed results. Sometimes it stops, sometimes I get garbage characters in the serial output. I think I'll stick with using the resistor since it works perfect with it.

>>is your chip being turned on from 5 volts on another pin??? That 675 can run without the VCC connected up, and another pin connected to 5 volts.

Nope, I have pin 8 going to ground and pin 1 going to the +5V rail.

I'm now going to try using the internal resistors with this DS1820 and see what happens. Hopefully it will work properly. I'll post my results.

Dwayne
- 30th July 2004, 14:34
Hello CocaColaKid,

CCK>>This is tied to a backpack LCD so I can see what is happening. When the MCLR is tied to the rail it works flawless. Remove the resistor and get mixed results. Sometimes it stops, sometimes I get garbage characters in the serial output. I think I'll stick with using the resistor since it works perfect with it.<<

I am sorry, but I guess I don't have a answer for you on that MCLR one. The only thing I can think of, is the programmer does not have MCLR set to "Input". But if a resister works...sometimes we can say "Thats it".

CCK>>I'm now going to try using the internal resistors with this DS1820 and see what happens. Hopefully it will work properly. I'll post my results.<<

Yes, tell me the results. I will be very interested on how that DS1820 preforms...

Dwayne

CocaColaKid
- 30th July 2004, 15:27
Do I set the WPU to %01000000 or %00000010 when I have the data line connected to gpio.1? I presuming its that later of the two but I want to make sure. The datasheet indicates that it bit 1 should be 1.

Dwayne
- 30th July 2004, 17:00
Hello CocaColaKid,

CCK>>Do I set the WPU to %01000000 or %00000010<<

Always start from the right LSB...One thing to remember, turn off your Comparators. GPIO.0 and GPIO.1 (if I remember correctly) are also your Comparators.

I would hex "all" the Weak Pull Ups. but if you don't want to.....%00000011 will do it.


CCK>> when I have the data line connected to gpio.1? I presuming its that later of the two but I want to make sure. The datasheet indicates that it bit 1 should be 1.<<

I don't have the datasheet in front of me, but Bit one mean the first bit? or the Bit counting from Bit 0. <g>. Thus, turn both bit zero and 1 on, and you got yourself covered until it is working. Then try turning off Bit zero, and see if it runs.


Dwayne