I'm a relative newbie to PIC's and having trouble getting a 12F675 to simply blink a LED on GPIO4. I have Flowcode3 and recently upgraded to the Pro version. My Flowcode simulates fine, but will not run at all after programming the PIC. I use a Melabs U2 programmer and the hex files appear to be loading fine.
I'm using the internal osc (4MHz) and saving the calibration, not using any resets (WDT,POR,BOR, etc.) and my target circuit looks good with a solid 5.06vdc supply, sourcing the LED through a 1K resistor to GND. I have programmed other devices (mainly 16F877's) with more complicated code, so this seems silly.
I'm sure I am missing something simple... anyone?
Thanks in advance.
PIC12F675- LED on GPIO4
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PIC12F675- LED on GPIO4
Hello
Firstly make sure that you have configured the chip to use "Internal RC No Clock" under the expert options for the configuration. Also you may have to enable the GPIO pull ups to allow the port to drive the I/O pin high.
Are you using an internal or external MCLR, if it is external then you will need to power this via a 1k resistor connected to your 5V supply.
This code enables all of the pull ups for the GPIO port. It may not be needed to get your program to run but if your still having no luck then it is worth a try.
Your LED resistor could come down to 220 / 300 Ohms instead of 1K to give a better LED brightness.
Firstly make sure that you have configured the chip to use "Internal RC No Clock" under the expert options for the configuration. Also you may have to enable the GPIO pull ups to allow the port to drive the I/O pin high.
Are you using an internal or external MCLR, if it is external then you will need to power this via a 1k resistor connected to your 5V supply.
This code enables all of the pull ups for the GPIO port. It may not be needed to get your program to run but if your still having no luck then it is worth a try.
Code: Select all
option_reg.GPPU = 0;
wpu = 0xFF;
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: PIC12F675- LED on GPIO4
Bingo- I was sure it was something simple. I had selected external MCLR, when this was not my intention. This was my first use of a forum such as this and I must say that I am impressed with the speed and professionalism of the response. Thanks Ben- you are the man!
On to my real project in mind...
Mike
On to my real project in mind...
Mike
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PIC12F675- LED on GPIO4
Thanks Mike
Glad to be of service Let us know how your getting on with your project.
Glad to be of service Let us know how your getting on with your project.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel