PIC12F1822 is not running

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
Rabbit
Posts: 28
Joined: Wed Apr 04, 2012 1:33 pm
Has thanked: 3 times
Been thanked: 3 times
Contact:

PIC12F1822 is not running

Post by Rabbit »

Hi experts,
In the pased I used the PIC16F877A with success.
Now I use the "little" PIC12F1822. Therefor I wrote a little test programm (LED on/off with waiting 1 sec.). The simulation is running well. But the LED on the LED-board connected to EB-006/Port-A will not flashing. I think the problem is the PIC-configuration. At the attachment you will find a screenshot of the PIC-configuration.
Is there something wrong?
Must I change at EB-006 the two OSC-Jumper (J18;19)?
Thank's for your help.
Rabbit
Attachments
PIC12F1822-configuration.jpg
PIC12F1822-configuration.jpg (213.93 KiB) Viewed 4733 times

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC12F1822 is not running

Post by medelec35 »

Hi Rabbit,

You will need to disable watchdog timer.

What osc speed have you set your project to?

I assume you want to use internal osc as per your configuration, rather than external osc?

If so the PLL will be prob 4x internal osc speed ( I have not looked at the data sheet)
So if running at 4 or 8MHz then PLL has to be disabled.

It maybe better if you can post your flowchart and let us know what speed you would like osc to run at.

Martin
Martin

Rabbit
Posts: 28
Joined: Wed Apr 04, 2012 1:33 pm
Has thanked: 3 times
Been thanked: 3 times
Contact:

Re: PIC12F1822 is not running

Post by Rabbit »

Hi Martin,
Many thanks for your answer.

Why should I disable watchdog timer? The later application should run without any problems.
Yes you assume right: I want to use internal OSC with 16MHz
Best regards Rabbit
Test-12F1822-#2.fcf
(13 KiB) Downloaded 292 times

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC12F1822 is not running

Post by medelec35 »

Hi Rabbit, Would you like to give attached flowchart a try please.

If It works then I will explain what I did.

Martin
Attachments
Test-12F1822-#3.fcf
(9 KiB) Downloaded 212 times
Martin

Rabbit
Posts: 28
Joined: Wed Apr 04, 2012 1:33 pm
Has thanked: 3 times
Been thanked: 3 times
Contact:

Re: PIC12F1822 is not running

Post by Rabbit »

Hi Martin, I tested your flowchart, but without success.
Thans for your help.
Rabbit

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC12F1822 is not running

Post by medelec35 »

Ahh,
I have just figured it could be a bug with ppp, I have posted about that else where.
Even though I disabled PLL and LVP. When Flowchart is saved, and reloaded PLL and LVP are re-enabled.
I have modified configuration settings with MPLAB for you to try.
You can use PPP to load hex file and send to your target device.

Note:
The thing to remember is with 8pin devices it is only bit A2 that connects to port A.
So if you see an led flashing with LED eblock plugged into port A it will only be bit A2.

Bit A0 connects to port B7
and
Bit A1 connects to port B6
So even if all was ok you will not see as many LED's lighting up as expected.
I have enabled Auto clear watchdog, so it should not matter about the 1 second delays with watchdog timer enabled.
Would you mind trying this one and see if it works this time please?

Also
Is your device programming ok?
perhaps you can use ppp to read contents of your 12F1822 and post hex file for me to take a look at.

Martin
Attachments
Test-12F1822- V4.hex
(12.46 KiB) Downloaded 195 times
Martin

Rabbit
Posts: 28
Joined: Wed Apr 04, 2012 1:33 pm
Has thanked: 3 times
Been thanked: 3 times
Contact:

Re: PIC12F1822 is not running

Post by Rabbit »

Good morning Martin,
Have than's for your work.
It's well, the LED's are lighting up as expected.
It was my bug, i look again to the EB006 circuit diagram and change the LED-board to Port B and all is right!

But there is one thing i don't understand: the Oscillator Control Register.
You set OSCCON to hex 73 and this is acc. to datasheet 8MHz.
Now I set OSCCON to hex FA and this is 16 MHz. LED board is lighting too.
Is there any possibility for measuring the internal oscillator frequency?
Best regards
Rabbit

Rabbit
Posts: 28
Joined: Wed Apr 04, 2012 1:33 pm
Has thanked: 3 times
Been thanked: 3 times
Contact:

Re: PIC12F1822 is not running

Post by Rabbit »

Hi Martin,
I forgot something: Test-12F1822-#3.fcf is running.
Rabbit

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC12F1822 is not running

Post by medelec35 »

Rabbit wrote:But there is one thing i don't understand: the Oscillator Control Register.
You set OSCCON to hex 73 and this is acc. to datasheet 8MHz.
Now I set OSCCON to hex FA and this is 16 MHz. LED board is lighting too.
Is there any possibility for measuring the internal oscillator frequency?
Hi Rabbit
0x70 = 8MHz
0x78=16MHz if pll is disabled in configuration menu
0x78=32MHz if pll is enabled in configuration menu
FA = 16MHz, Even though its setting bit 7 (PLL enable bit) PLL will not be active because bit 1 is set which stops PLL being active. So this setting I would not recommend.
F8 = 32MHz which is overriding PLL enable in configuration menu.
So even if PLL is set to disable, there should still be 32MHz

I would recommend using 0x78 instead, as it is set in Test-12F1822-#3.fcf
I would assume 0x73 was a typo?

You can test the osc frequency by setting clock out as enabled in the configuration menu, then measure frequency on pin3 (RA4).
This frequency should be osc frequency/4

Hope this helps to clear up confusion.

Martin
Martin

Rabbit
Posts: 28
Joined: Wed Apr 04, 2012 1:33 pm
Has thanked: 3 times
Been thanked: 3 times
Contact:

Re: PIC12F1822 is not running

Post by Rabbit »

Hi Martin,
Have many thanks for your help. First I will do some application-tests.
Best Regards Rabbit

Post Reply