PIC12f510

For general Flowcode discussion that does not belong in the other sections.
alanwms
Posts: 145
http://meble-kuchenne.info.pl
Joined: Fri Dec 04, 2020 2:29 pm
Has thanked: 26 times
Been thanked: 7 times

PIC12f510

Post by alanwms »

Hello:

I have the PIC12f510 program simply turning an LED on in an infinite while loop. Setup the speed for 8mhz internal osc. The program downloads, but there is no activity on the GP2 (LED connected to GP2).
There are only a few project option selections for this chip regarding oscillator. Do I have to insert c code to get the oscillator to run? I disabled my dwells just in case, but I see no activity on the io port. Attempted manual memclr reset - no luck

Simple FC10 file attached

Help appreciated - Thank you.
Attachments
Test Routine.fcfx
(7.31 KiB) Downloaded 44 times

chipfryer27
Valued Contributor
Posts: 1684
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 374 times
Been thanked: 583 times

Re: PIC12f510

Post by chipfryer27 »

Hi

Yes you do need to include a C-block to use the internal oscillator and this should be your first block.

FC makes this easy. You will find a component called IntOsc Helper in Components>Runtime (I think). This will check settings and provide the code. Simply copy and paste into your C-Block.

Regards

chipfryer27
Valued Contributor
Posts: 1684
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 374 times
Been thanked: 583 times

Re: PIC12f510

Post by chipfryer27 »

Hi

Following on, it seems FC may have a "bug" in that the OscHelper doesn't recognise the chip.

I will dig put the datasheet to see what the register setting needs to be, but this may not be until tomorrow.

Regards

alanwms
Posts: 145
Joined: Fri Dec 04, 2020 2:29 pm
Has thanked: 26 times
Been thanked: 7 times

Re: PIC12f510

Post by alanwms »

OK

alanwms
Posts: 145
Joined: Fri Dec 04, 2020 2:29 pm
Has thanked: 26 times
Been thanked: 7 times

Re: PIC12f510

Post by alanwms »

It seems to me that the configuration bits can only be set upon program mode entry suggesting that I can't put a C code in the 'Main'
Those bits ARE set in the "program options" but don't seem to work. Maybe I'm doing something to hinder that - not sure.

Also - The "Download config now" in the project options is doing nothin. I thought I would try that.

chipfryer27
Valued Contributor
Posts: 1684
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 374 times
Been thanked: 583 times

Re: PIC12f510

Post by chipfryer27 »

Hi

I've not had a chance to look at the datasheet yet, hopefully later on.

Meanwhile I've attached a chart showing how to set up a PIC16F1939 to use an internal 8MHz clock. Most PICs are pretty similar but you do get the odd exception. In the chart you will see the IntOsc Helper component generating the required C-Code to use.

Regards
Attachments
IntOsc_Example.fcfx
(8.74 KiB) Downloaded 38 times

alanwms
Posts: 145
Joined: Fri Dec 04, 2020 2:29 pm
Has thanked: 26 times
Been thanked: 7 times

Re: PIC12f510

Post by alanwms »

Thanks for your efforts -
I don't think that the pic12f510 has an OSCCON register. From my readings, it's looking like the configuration file can only be downloaded at program time, and can't be configured in the main

chipfryer27
Valued Contributor
Posts: 1684
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 374 times
Been thanked: 583 times

Re: PIC12f510

Post by chipfryer27 »

Hi

It may not have an OSCON, the datasheet will specify the register name. My chart was really just to show the steps for "a" PIC.

Looking in the old forum I see this

https://www.flowcode.co.uk/mmforums/vie ... 510#p14659

Seems about 16 years ago the chip may have been dropped.

Regards

mnfisher
Valued Contributor
Posts: 1628
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 142 times
Been thanked: 761 times

Re: PIC12f510

Post by mnfisher »

As an idea..

I don't have the particular part to try though.

Run pickit3.exe - this is microchip's (GUI) programming tool.
With the PicKit connected to the (powered) MCU - it should display PicKit3 connected - (click on Tools-Check Communication if needed) PIC Device found and above that - the part number. Click on configuration and see what is saved there (and adjust if required)

The issue is finding the download if you don't already have it (part of the MPLab studio I believe)

Can do a similar thing with the excellent (but not free - I have no affiliation) PicKitPlus.

I'll try a bit harder and find where I downloaded it from.

MArtin

medelec35
Matrix Staff
Posts: 2086
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 644 times
Been thanked: 701 times

Re: PIC12f510

Post by medelec35 »

Hello.
As there is no output for you on A2, I was wondering why you are using osccal as that is only to adjust the osc speed above or below the centre frequency for extra precision, if the frequency is off a bit.
There are no other registers like osccon since there are only two selectable frequencies (4 & 8 MHz) from withing the configuration settings.
So no bug within internal oscillator component.
As you got master clear enable bit to enabled, it will be worth measuring the voltage across pin 4 and GND, making sure its at the same voltage as VDD (+supply voltage).
Martin

Post Reply