Problems with PIC12F629 that doesn't program them to work

Moderator: Benj

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

Problems with PIC12F629 that doesn't program them to work

Postby bruno504 » Wed Apr 01, 2020 8:29 pm

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. ... trix_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: 14797
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4759 times
Been thanked: 4362 times
Contact:

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

Postby Benj » Wed Apr 01, 2020 11:00 pm

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: 15
Joined: Wed Apr 01, 2020 8:03 pm
Contact:

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

Postby bruno504 » Wed Apr 01, 2020 11:34 pm

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: 15
Joined: Wed Apr 01, 2020 8:03 pm
Contact:

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

Postby bruno504 » Wed Apr 01, 2020 11:53 pm

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

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8826
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2561 times
Been thanked: 3721 times
Contact:

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

Postby medelec35 » Thu Apr 02, 2020 12:10 am

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

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

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

Postby bruno504 » Thu Apr 02, 2020 12:18 am

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

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8826
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2561 times
Been thanked: 3721 times
Contact:

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

Postby medelec35 » Thu Apr 02, 2020 12:52 am

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

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

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

Postby bruno504 » Thu Apr 02, 2020 1:09 am

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
(538 Bytes) Downloaded 10 times

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

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

Postby bruno504 » Thu Apr 02, 2020 1:43 am

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.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8826
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2561 times
Been thanked: 3721 times
Contact:

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

Postby medelec35 » Thu Apr 02, 2020 10:26 am

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

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

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

Postby bruno504 » Thu Apr 02, 2020 12:53 pm

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?! :(

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8826
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2561 times
Been thanked: 3721 times
Contact:

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

Postby medelec35 » Thu Apr 02, 2020 4:07 pm

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

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

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

Postby bruno504 » Thu Apr 02, 2020 8:30 pm

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

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8826
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2561 times
Been thanked: 3721 times
Contact:

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

Postby medelec35 » Thu Apr 02, 2020 9:03 pm

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
(673 Bytes) Downloaded 9 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

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

Postby bruno504 » Thu Apr 02, 2020 9:06 pm

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

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8826
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2561 times
Been thanked: 3721 times
Contact:

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

Postby medelec35 » Thu Apr 02, 2020 9:29 pm

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

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

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

Postby bruno504 » Thu Apr 02, 2020 9:44 pm

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...

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8826
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2561 times
Been thanked: 3721 times
Contact:

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

Postby medelec35 » Fri Apr 03, 2020 12:03 am

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
(694 Bytes) Downloaded 10 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

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

Postby bruno504 » Fri Apr 03, 2020 1:38 am

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

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8826
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2561 times
Been thanked: 3721 times
Contact:

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

Postby medelec35 » Fri Apr 03, 2020 1:07 pm

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 5 times
blink teste configs 2 XC8 v2.10.hex
(612 Bytes) Downloaded 4 times
These users thanked the author medelec35 for the post (total 2):
jgu1 (Fri Apr 03, 2020 2:26 pm) • chipfryer27 (Sun Apr 05, 2020 12:13 pm)
Rating: 10%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

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

Postby bruno504 » Fri Apr 03, 2020 1:38 pm

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

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

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

Postby bruno504 » Sat Apr 04, 2020 2:29 pm

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
Posts: 220
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 145 times
Been thanked: 108 times
Contact:

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

Postby chipfryer27 » Sun Apr 05, 2020 12:30 pm

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: 15
Joined: Wed Apr 01, 2020 8:03 pm
Contact:

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

Postby bruno504 » Mon Apr 06, 2020 2:08 am

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: 14797
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4759 times
Been thanked: 4362 times
Contact:

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

Postby Benj » Thu Apr 30, 2020 3:37 pm

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.
These users thanked the author Benj for the post:
medelec35 (Thu Apr 30, 2020 4:05 pm)
Rating: 5%