Problems with PIC12F629 that doesn't program them to work

Moderator: Benj

bruno504
Posts: 17
Joined: Wed Apr 01, 2020 8:03 pm
Contact:

Re: Problems with PIC12F629 that doesn't program them to work

Post by bruno504 »

any solution?!

Simon-ST
Posts: 12
Joined: Thu Aug 19, 2021 12:43 pm
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: Problems with PIC12F629 that doesn't program them to work

Post by Simon-ST »

Hi All,

Just wondering if anyone ever got to the bottom of this as I have just fallen in to exactly the same rabbit hole, before I looked on here. Unfortunately I can no longer get FC6 to run on my laptop so I don't have the option of going back to it to modify the code I wrote previously. I have also just written a loop with an on and off with 2 delays, can't get much more simple and I can not get it to work. I know the chip is programming as I can select either "Internal RC Clockout" or "Internal RC No clock" and with a scope on pin 3 I can see the 1Mhz clock pulse appear of disappear. As a sanity check I recomplied the same code with a PIC16F688 and it worked first time. I think this has to be a bug in FC8.

I would really appreciate getting this to work as I am going to have to re-spec the PIC and start again on a previous design if I can't.

I did note, that I am sure the ports used to be shown as GP0-5 as they are shown in the datasheet but in FC8 they are shown as A0-A5. Not sure if this makes a difference.

Many Thanks.

Simon.

User avatar
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: Problems with PIC12F629 that doesn't program them to work

Post by Benj »

Hi Simon,

There are reports of other people having problems with a specific version of the XC8 compiler. I wonder if it's worth trying the updated toolchain from here and see how you get on with that.

https://www.flowcode.co.uk/download/fil ... _PICv2.msi

The location of the toolchain can be set in Flowcode by using Regedit, be very careful using regedit as it can damage your Windows installation.

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\MatrixTSL\Flowcode\Common

And edit the key

Compiler_pic

From this

C:\Program Files (x86)\Flowcode\Common\Compilers\pic

to this.

C:\Program Files (x86)\Flowcode\Common\Compilers\picv2

Simon-ST
Posts: 12
Joined: Thu Aug 19, 2021 12:43 pm
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: Problems with PIC12F629 that doesn't program them to work

Post by Simon-ST »

Hi Ben,

Thanks very much for this, I will give it a go when I am back in the workshop and I will post the results on here.

SImon.

Simon-ST
Posts: 12
Joined: Thu Aug 19, 2021 12:43 pm
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: Problems with PIC12F629 that doesn't program them to work

Post by Simon-ST »

Hi Ben,

Sorry no joy, I have updated the complier, and I am pretty sure it updated as my firewall created havoc, that fixed and I can program the PIC either with Clock out or not and I can see the change on a scope, as before, but still no output.

Any other ideas?

Thanks

Simon.

User avatar
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: Problems with PIC12F629 that doesn't program them to work

Post by Benj »

Hi Simon,

Thanks for letting us know. I've been doing some reading and gone back through the code produced by Flowcode and so far I have't found any problems. The chip I have also isn't working but is very old now and so I'll see if I can get my hands on a new one to do more tests with.

Simon-ST
Posts: 12
Joined: Thu Aug 19, 2021 12:43 pm
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: Problems with PIC12F629 that doesn't program them to work

Post by Simon-ST »

Hi Ben,

Thanks for this. As I said I did note that the properties show port A and I am sure they used to show GP as on the data sheet, how this translates into the .hex file I don't know and it may make no difference.

If you are stuck for a chip, I have a draw full of them, I can easily send you a couple, if you can PM or E mail me an address.

Simon.

User avatar
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: Problems with PIC12F629 that doesn't program them to work

Post by Benj »

Hello,

That would be brilliant if you don't mind, I'll PM you the address.

Simon-ST
Posts: 12
Joined: Thu Aug 19, 2021 12:43 pm
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: Problems with PIC12F629 that doesn't program them to work

Post by Simon-ST »

Hi Ben,

I have just managed to catch todays post. They are on their way to you.

Simon.

User avatar
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: Problems with PIC12F629 that doesn't program them to work

Post by Benj »

Hi Simon,

Many thanks for sending the chips and sorry for the delay. I've been doing some digging using them this morning and found out the problem seems to be to do with the configuration.

If I use the __PROG_CONFIG method to set the configuration value then the chip does not work.

Code: Select all

__PROG_CONFIG(0x1, 0xF1F4);
Interestingly it does not appear that the setting is making it into the hex file.

Memory Summary:
Program space used 20h ( 32) of 400h words ( 3.1%)
Data space used 5h ( 5) of 40h bytes ( 7.8%)
EEPROM space used 0h ( 0) of 80h bytes ( 0.0%)
Data stack space used 0h ( 0) of 3Bh bytes ( 0.0%)
Configuration bits used 0h ( 0) of 1h word ( 0.0%)
ID Location space used 0h ( 0) of 4h bytes ( 0.0%)

However if I enter the config like this then it works.

Code: Select all

#pragma config FOSC = INTRCIO   // Oscillator Selection bits (INTOSC oscillator: I/O function on GP4/OSC2/CLKOUT pin, I/O function on GP5/OSC1/CLKIN)
#pragma config WDTE = OFF       // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = OFF      // Power-Up Timer Enable bit (PWRT disabled)
#pragma config MCLRE = ON       // GP3/MCLR pin function select (GP3/MCLR pin function is MCLR)
#pragma config BOREN = ON       // Brown-out Detect Enable bit (BOD enabled)
#pragma config CP = OFF         // Code Protection bit (Program Memory code protection is disabled)
#pragma config CPD = OFF        // Data Code Protection bit (Data memory code protection is disabled)
I'll do a bit more digging and see if I can find out why the __PROG_CONFIG isn't working.

User avatar
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: Problems with PIC12F629 that doesn't program them to work

Post by Benj »

I've posted a new definition file to the v8 and v9 update systems which should hopefully solve the problem for you.

Please note once you have downloaded the definition update you will have to go into the project options and redo your chip configuration settings as they are now in a new format.

Simon-ST
Posts: 12
Joined: Thu Aug 19, 2021 12:43 pm
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: Problems with PIC12F629 that doesn't program them to work

Post by Simon-ST »

Hi Ben,

Sorry, I have only just seen your reply, no worries on the chips, thanks for looking into this.
I have just updated to FC9 and I have just tried the update in both FC8 and FC9 and I am afraid I am still having problems.

I have started again in both FC8 and 9 and written a simple loop that just has an output that toggles on and off with a time delay in between each, again I have set the clock to both the CLOCKOUT and IO on pin 3, by programming the chip with both versions I can see the clock appear and disappear, I can not get the output pin to change state, I have tried 2 different output pins in case that had something to do with it, I have set the clock frequency to 4Mhz, which the scope on pin 3 confirms.

The complier shows 100% used on the configuration bit, so i don't think that's it.

I don't know how to interpret this but the .hex file that it spat out is:

:020000000B28CB
:10000800DE00030E8312B8000A08B9004F288316D1
:10001800FF23900083121028831320308400383087
:10002800472083012628BB0001308312BB023B0A0C
:1000380003190800C730BA002128BA0B2028242841
:100048002528182807309900C030831681003220EF
:10005800323017203D20323017202B28DF30831212
:10006800BA003A08831685058312050820388500EA
:100078000800DF30BA003A088316850583120508A0
:10008800DF398500080064008001840A040603192A
:1000980000340406482839088A00380E8300DE0E2A
:0400A8005E0E0900DF
:02400E00F4318B
:00000001FF

I note that on FC6 I am sure it referred to the pins as the data sheet does, GP0-GP5, where as FC8 and FC9 refer to them as Port A. No idea if this makes a difference though.

I even restarted the PC incase if hadn't read the updated file, I also checked for updates again and none appeared so I am assuming it installed properly.

Sorry to be a pest with this. Please let me know if you need me to send anything across. I don't think I am doing anything wrong but I am human, it is possible.

Thanks again,

Simon

Post Reply