Problems with PIC12F629 that doesn't program them to work

Moderator: Benj

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

Problems with PIC12F629 that doesn't program them to work

Post by bruno504 »

Hi,
In older versions of Flowcode v4, v5, v6 when programming the Pic12F629/675, I used a C box on start with "osccan = 0x080" to put this small microcontroller to work as "internal RC CLKout" whell configurated (other options were simple to config like clk=4Mhz etc) to work , but now with Flowcode 8.0, I try to import the same old program I made (working one) from back and when I try to compile it on Hex, it gives me an error that is: " ^ (192) undefined identifier "osccal".
I managed and changed so many options around this confgurations but without success, because simply sending the program to the microcontroller when it is supposed to work alone, it does nothing at all!
Also I read the matrix help about this and it suggests doing this: https://www.matrixtsl.com/wikiv7/index. ... rix_Tools) , but it doesnt help on this kind of pic12f because it allways say that it doesnt have internal oscillator?!
Can you test this with simple LED flash code, using this Pic12f629/675 and help me find the solution please! what I need to do?

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,

Try this instead.

OSCCAL = 0x80;

We moved to the XC8 compiler for Flowcode v7 and this requires register names in upper case.

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 »

I tried that option, it no more gives error compiling the hex file, but still microchip doesn't work, in simple program it won't blink the LED!
Any more suggestions?

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 »

This is the simple program configuration, see image...
Attachments
flowcode 1.jpg
flowcode 1.jpg (81.71 KiB) Viewed 11181 times

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

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

Post by medelec35 »

Hi bruno504,
We can't see everything within one image.
Can you post your flowchart please.
Also, could it be a programming issue?
do you have confirmation of chip being programmed and verified OK?
Martin

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 »

here it is in attachments...
Attachments
blink teste configs.fcfx
(9.38 KiB) Downloaded 241 times

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

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

Post by medelec35 »

I can't see any issues with your Flowchart that would prevent LED from flashing.
It could flash at slightly incorrect frequency as I believe OSCCAL value is factory preset to give correct 4MHz internal osc frequency.
You are overriding this to center frequency by using

Code: Select all

OSCCAL = 0x80
.
As setting a single pin you don't need 255,just use 1.
That won't affect anything so LED should still flash.
So either config settings are not being sent to programmer (or switched off withing programmer).
Programmer is not successfully programming and varying.
Faulty chip, incorrect wiring to chip (if not programming OK) , or LED/resistor not wired correctly.
Can you remove the connection from pin A1 to LED/resistor and connected LED/resistor directly to +supply & make sure it lights up.
All else fails, can you post hex file, so I can check it.
Martin

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 »

Yes looking my program it would work, I know about 255 insted of true or "1", but I'm tired to change everything to make it work one time!
Yes the pic programmer works, I can upload to pic 12f629 other hex file that I had from couple of years now (made on flowcode v4 and v5, I'm sure microchip pic12f629 is good too so, must be the compiler to hex file, or eventually the chip programmer, but it worked with other hex files!?
Im using microchip PICDEM 2 plus, LED's are conneted correctly by years ago, the fact is when using oscilloscope to see what is going on in pins of the pic12f629 to ground, they are complettly freezed ! so it's because I saied that pic12f doesnt work at all!
Attachments
blink teste configs.hex
(524 Bytes) Downloaded 242 times

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 »

For you to know if I configure chip to "Int RC clockout" after program the pic12f and put it on test board, it doesn't do nothing from what I programmed (blinking LED) but measuring the pin 3 (clk out) I can measure square wave with 1,130MHz.

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

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

Post by medelec35 »

Nothing appears to be wrong with with hex file.
Configuration settings are correctly embedded.
bruno504 wrote:but measuring the pin 3 (clk out) I can measure square wave with 1,130MHz.
It should be 1MHz, so that back ups what I was saying
medelec35 wrote: I believe OSCCAL value is factory preset to give correct 4MHz internal osc frequency.
You are overriding this to center frequency by using

Code: Select all

OSCCAL = 0x80
bruno504 wrote: I can upload to pic 12f629 other hex file that I had from couple of years now (made on flowcode v4 and v5, I'm sure microchip pic12f629 is good too
I have attached a hex file created by Flowcode V5 to flash LED on A1 every second.
Enabled clockout and disabled brownout in case voltage is too low.
So you can see if all is working using FC5.
I could be wrong but don't think it would make any difference?

To me it does look like a hardware issue.
Check supply voltage going to the chip, if too low then brownout will occur.
Is the power supply steady?
Next I would remove power.
Check A1 for shorts to ground, and its connected to resistor/LED anode.
Also check LED cathode is connected to ground.
Another thing you can do is power back on the board, erase chip (so all pins default to high impendence state), then link A1 to the chip supply.
Martin

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 »

tested this for ours... it won't work on this chips pic12f629, I'm using 9V battery, voltage is regulated to 5V checked, LED's all well connected to the pic12f, programmer is working with this chip also, because can load and program pic12f with older hex files and everything works. I just don't understand what is wrong in compiler of flowcode!? If you want I can make a video to YouTube showing this problem with Flowcode 8. any more suggestions?! :(

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

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

Post by medelec35 »

Sorry attachment hex file created by Flowcode V5 did not get attached in my last post. Here it is.
Attachments
LED Blink FC5.hex
(712 Bytes) Downloaded 224 times
Martin

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 »

the hex file you sent to me works great, how did you do it? it was compiled on flowcode 8?

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

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

Post by medelec35 »

bruno504 wrote:the hex file you sent to me works great
Oh, that does change things.
No I created it in Flowcode V5 as a sanity check.
Just one more hex file to test.
Attachments
blink teste configs.hex
(656 Bytes) Downloaded 161 times
Martin

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 »

But that last you sent to me now, doesn't work!
What is wrong?!

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

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

Post by medelec35 »

Ok the issues is with Flowcode V8 or XC8.
I'm surprised as its an old chip and only getting the port to change output.
It may have to be matrix staff that sorts this out.
I'm looking into it to see if I can get V8 to work.
Can't promise anything at this stage.
Martin

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 »

I'm not surprised, because ten years ago I found problems on Flowcode at the time it was relative to pic16f84 or 88 something near this kind of microcontroller... I have been lucky on find small hidden bugs on this software that I love so much!
Any help from me just write to me, I can test it quickly in my hardware systems! I got everything needed.
Thank you, I'll wait for the quick solution...

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

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

Post by medelec35 »

Not sure whats going on as checked SFR registers on two different simulators and FC5 & FC8 hex files give similar SFR results.
Difference is FC5 does set OSCCAL = 0x80; as a default, FC8 does not.
Can you try final hex file please?
May not work, but I have had a go.
Attachments
blink teste configs 2.hex
(676 Bytes) Downloaded 157 times
Martin

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 »

Doesnt do nothing. Only clkout is present on respective output pin.

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

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

Post by medelec35 »

LED flashed when hex file was created using Flowocde V5 therefore we can say hardware is working.
Since LED is not flashing with any of the flowcharts created with Flowcode V8,
I have moved topic to the bugs section for Matrix staff to look into.

To see if its a compiler issue, I recompiled using XC8 v2.10 instead of the xc8 version shipped with Flowcode.
I have also attached flowchart created in FlowcodeV8 for staff to look at as a sanity check for me.
Attachments
blink teste configs 2 XC8 v2.10.fcfx
(6.85 KiB) Downloaded 156 times
blink teste configs 2 XC8 v2.10.hex
(596 Bytes) Downloaded 152 times
Martin

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 »

I tested the "blink teste configs 2 XC8 v2.10.hex" and it doesn't work, I only got clkout working.

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 »

by what I can see, maybe in Flowcode v8 is missing the GPIO PORT configurations, because I can't see this on C code compiled:
#define porta gpio;
#define trisa trisio;

Could it be?!

chipfryer27
Valued Contributor
Valued Contributor
Posts: 618
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 184 times
Been thanked: 195 times
Contact:

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

Post by chipfryer27 »

Hi

A few years ago (circa 2016) I created a program for a 12F675 using FC6 without issue. Nothing terribly exciting and timing was not critical. Basically it slept until an interrupt woke it, then processed before returning to sleep. Did all it needed to without issue.

Some months back I revisited the code using FC8 for a new project that would be quite similar. After updating what little "C" blocks there were I couldn't get it to run at all. I then completely wrote the code again from scratch using FC8 but still couldn't get it to work. To say it was frustrating is an understatement.

Having very little time to explore further I returned to FC6, made whatever changes necessary and it worked.
medelec35 wrote:Ok the issues is with Flowcode V8 or XC8.
I'm surprised as its an old chip and only getting the port to change output.
It may have to be matrix staff that sorts this out.
I'm looking into it to see if I can get V8 to work.
Can't promise anything at this stage.
So it seems I'm not alone and wasn't going insane...:)

Regards

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 »

yes it's true I went back to Flowcode 6 and everything runned well !
I'm using Flowcode 8 for arduino.
At least I post this problem for anyone know about it.

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 might have one or two of these chips kicking about the office. I'll see if I can dig one out next time I'm in and have a play.

Post Reply