Problem programming Chip

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

kersing
Valued Contributor
Valued Contributor
Posts: 1873
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 530 times
Been thanked: 1040 times
Contact:

Re: Problem programming Chip

Postby kersing » Sat Jun 08, 2013 11:12 pm

Sorry, should have been clearer, I don't mean programming power, I meant runtime power.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

JDR04
Posts: 264
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Problem programming Chip

Postby JDR04 » Sat Jun 08, 2013 11:47 pm

Just inserted a brand new PIC16F690 and confirmed its memory was empty before doing anything.

Downloaded the program into the chip and verified with PICKit2 software and all seems OK.

Checked communication between laptop and PICKit2 programmer all seems OK, chip is detected correctly.

What can I do now?? JDR04

JDR04
Posts: 264
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Problem programming Chip

Postby JDR04 » Sun Jun 09, 2013 8:57 am

Today I redid the flow chart thinking there mught have been some sort of error someplace. However I am back to the very begining with the same problems.

It compiles to C ok.....thats the message I get?
When compiling to HEX the problem starts.

So, I have inserted a new chip, redid the flowchart and am no further forward yet.

I also get the following error when trying to compile to HEX

Hex file not found
Return code 37
If your flowchart contains C code, please review this carefully. If your flowchart contains no C-code or you have thoroughly reviewed the code, contact Technical Support.

Any ideas on this will be appreciated. JDR04

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 514 times
Been thanked: 467 times
Contact:

Re: Problem programming Chip

Postby dazz » Sun Jun 09, 2013 10:04 am

Hi
Can you try burning one of the files provided by microchip with your board as if that works it proves the chip/board and programmer are ok.
Then burn thethe attached hex file, don't adjust it just program it and see if it works
let us know if it works

Regards
Dazz
Attachments
agitator servo 1 (2)11.hex
(964 Bytes) Downloaded 58 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

kersing
Valued Contributor
Valued Contributor
Posts: 1873
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 530 times
Been thanked: 1040 times
Contact:

Re: Problem programming Chip

Postby kersing » Sun Jun 09, 2013 10:09 am

Could you try the steps I described in this post? The hex file to import should be in same folder your flowcode file has been saved. By using MPlab to program (and set power and release chip from reset) you should at least be able to see if the program works. You might want to try with the program medelec35 posted for you as he tested it and confirmed it worked.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

JDR04
Posts: 264
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Problem programming Chip

Postby JDR04 » Sun Jun 09, 2013 5:48 pm

Hello Dazz, used the PICKit2 software to import and burn the hex file you kindly provided and now 2 of the LED's are flashing alternatively.

So, now I'm really scratching my head. What do we do?

Could it be my antivirus software that is interfering with FLOWCODE when it converts from C to hex? Just a guess??

JDR04
Posts: 264
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Problem programming Chip

Postby JDR04 » Sun Jun 09, 2013 5:52 pm

Hi Kersing, thanks for the suggestions. You'll see the program Dazz supplied is now flashing the LED's in question. I did however use the PICkit2 software to burn the chip and not FLOWCODE.

I'm just waiting for Dazz to come back to me and then I will endevour to try what you have suggested. Thanks again JDR04

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 514 times
Been thanked: 467 times
Contact:

Re: Problem programming Chip

Postby dazz » Sun Jun 09, 2013 6:19 pm

HI jdr
I just let flowcode handle the config,the hex was compiled in flowcode, in build options i set the clock speed to 8Mhz, then in the config tab i set power up timer to on, osc selection to internal no clock. and i disabled your c code block

the flowchart is attached

Regards
Dazz
Attachments
agitator servo 1 (2)11.fcf
(8 KiB) Downloaded 62 times
These users thanked the author dazz for the post:
JDR04 (Sun Jun 09, 2013 9:27 pm)
Rating: 5.26%
 
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

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

Re: Problem programming Chip

Postby medelec35 » Sun Jun 09, 2013 6:58 pm

Hi.
dazz wrote: i set the clock speed to 8Mhz,

dazz wrote: i disabled your c code block

Only thing is the clock speed should be set to 4MHz with no c code block setting osccon value.
Since 4MHz is default clock speed on reset.

Martin
These users thanked the author medelec35 for the post:
JDR04 (Sun Jun 09, 2013 9:27 pm)
Rating: 5.26%
 
Martin

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

JDR04
Posts: 264
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Problem programming Chip

Postby JDR04 » Sun Jun 09, 2013 9:10 pm

Thanks Dazz, I'll give it a try and let you know the outcome.

JDR04
Posts: 264
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Problem programming Chip

Postby JDR04 » Sun Jun 09, 2013 9:12 pm

Thanks Martin, I'll try what you have suggested after Dazz suggestion and see how that works out.

Really do appreciate your guys time and patience. JDR04

JDR04
Posts: 264
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Problem programming Chip

Postby JDR04 » Sun Jun 09, 2013 9:26 pm

Hi Dazz, opened your attachment and tried to download it into the chip but had the same problem from the very begining. Changed the settings you suggested as well. I set the clock to 4MHz as Martin suggested.

Also turned off the antivirus software I have but it did not help.

Also tried to burn the program with Vdd in the PICkit2 software ON and then Off but did not help.

I just cant believe that such a simple program in FLOWCODE can prove to be so troublesome. Any more ideas.

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

Re: Problem programming Chip

Postby medelec35 » Sun Jun 09, 2013 9:38 pm

For now, what about just compiling to hex then load hex up with your programmer and program target.
If compiling to hex was successful then if you compile to target device, can you post your compiler messages (Build compiler messages) please.

Its not just antivirus s/w that can interfere with programs like flowcode.
In my case both firewalls (comodo and open post) did as well.
But in Flowcodes defence, firewalls interfere with other installed s/w as well.

Martin
Martin

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

JDR04
Posts: 264
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Problem programming Chip

Postby JDR04 » Sun Jun 09, 2013 9:42 pm

Thanks Martin, I'll give your suggestion a try and then let you guys know the result...........

JDR04
Posts: 264
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Problem programming Chip

Postby JDR04 » Sun Jun 09, 2013 9:54 pm

Ok, for some reason there is no file ending with .hex. I checked and double checked. Nothing. I have all my Flowcode files going into one file and there is nothing in there .hex for this program.

Theres plenty of others, .asm; .c; .casm; .cof; .fcf; .Ist; -map; .obj; .stat; and .tree. Nothing ending in .hex.

Could this be the problem all along?????

Sorry.forgot the compiler messages you asked for.

Registered to: johnreunert
Licence key: J3UZRR
http://www.matrixmultimedia.com
Compilation is up-to-date
Linking is up-to-date
Launching the programmer...
C:\Program Files\Flowcode\V5\Tools\PICkit2\pk2cmd.exe -BC:\Program Files\Flowcode\V5\Tools\PICkit2\ -PPIC16F690 -Fagitator servo 1.hex -M -A5 -R
\ \ \ \| 
PICkit 2 Program Report
09-Jun-2013, 21:39:56
Device Type: PIC16F690
Program Succeeded.
Operation Succeeded
Return code = 0
FINISHED

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

Re: Problem programming Chip

Postby medelec35 » Sun Jun 09, 2013 10:09 pm

It could be that hex is assigned and your settings are set as default which hide know file extension types.
You will need to browse to correct directory with your programmer and load hex file from that.
To show the .hex extension

Click start, computer.
Click organize, Folder and search options, View tab, untick 'Hide extensions for know file types'
Then you should see the file name then .hex
The above should work with vista & windows7

Alternatively the word HEX should appear in the 'Type' column of windows explorer.

Martin

Edit:
Looking at your messages programming has succeeded meaning it should be working,
Can you measure voltage on pin RA3 (pin 4 of 16F690)
These users thanked the author medelec35 for the post:
JDR04 (Sun Jun 09, 2013 10:29 pm)
Rating: 5.26%
 
Martin

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

JDR04
Posts: 264
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Problem programming Chip

Postby JDR04 » Sun Jun 09, 2013 10:45 pm

OK, did that and found the .hex file. Thanks for that.

First erased the chips memory using PICKIT2 software and verified the chips memory was empty.

Then imported the hex file and burnt it into the chip. Can see the red busy light on the programmer flickering when I initiate this action.

Then used PICKit2 software to check the memory and it has data in it. I can see it but cannot understand it...no siree.

Measured pin 4 and got 5V with the scope.

Led's still not flashing. I've got two programmers and have tried both but the problem remains the same. Also changed the chip for a new one earlier on.

Thanks -JDR04

JDR04
Posts: 264
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Problem programming Chip

Postby JDR04 » Sun Jun 09, 2013 11:01 pm

I did a simple program of two flashing LED's about two months ago and all worked fine.

I reopened the flowchart and compiled the program to the chip, turned the Vdd in the PICKit2 software and presto the LED's began to flash alternatively.

So, I then erased the program fron the chips memory using PICkit2 software and verified the meory was empty.

Then went back into FLOWCODE and with the same program compiled to C, compiled to hex and compiled to chip..........now the LED's dont flash at all. It seems that now something is going wrong with the compiling to hex or compiling to chip etc.

Any ideas guys??

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

Re: Problem programming Chip

Postby medelec35 » Sun Jun 09, 2013 11:05 pm

can u post the c and hex files please.

I will take a look at them, and see if all is well with both files.
These users thanked the author medelec35 for the post:
JDR04 (Mon Jun 10, 2013 10:38 am)
Rating: 5.26%
 
Martin

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

JDR04
Posts: 264
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Problem programming Chip

Postby JDR04 » Mon Jun 10, 2013 10:38 am

Here are the C and hex files.

Thanks for your time and effort, mkuch appreciated. JDR04
Attachments
agitator servo 1.hex
(1.01 KiB) Downloaded 43 times
agitator servo 1.c
(3.48 KiB) Downloaded 43 times

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

Re: Problem programming Chip

Postby medelec35 » Mon Jun 10, 2013 12:03 pm

Hi JDR04
From looking at files you have sent, It looks like you're running an old version of Flowcode, which had a bug of not transferring configuration settings to hex file and hence not loaded into target device.
(I have confirmed this is the case since your hex file indeed does not contain the configuration settings you have set in Flowcode).
You should be running Flowcode V5.5.2.1
Solution is go to:
http://www.matrixmultimedia.com/flowcode.php
Scroll down page then in the download section & enter last two sections of your key.
The latest download should be then saved to your PC.
Also within Flowcode you can check if your running the latest version by selecting Help, About Flowcode.

After you have installed latest version of Flowcode and compiling to chip, your hardware should work.

Since Clock speed is set at 4MHz no osccon = 0x70;
C code block is required.
Only add the above osccon value if you want Clock speed to be 8MHz!

Martin
These users thanked the author medelec35 for the post:
JDR04 (Mon Jun 10, 2013 4:07 pm)
Rating: 5.26%
 
Martin

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

JDR04
Posts: 264
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Problem programming Chip

Postby JDR04 » Mon Jun 10, 2013 4:09 pm

Thanks Martin, I'll do what you have suggested.

How come the last time I used FLOWCODE I did not have this issue??

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

Re: Problem programming Chip

Postby medelec35 » Mon Jun 10, 2013 5:02 pm

JDR04 wrote:How come the last time I used FLOWCODE I did not have this issue??

Not sure? If you're using same version Flowcode as the one which worked.
All I can say is there was a version of V5 that did not transfer configuration to target device via hex file.
I can also say that configuration within C file is not the same as the configuration within hex file.
So I just put 2 & 2 together and assumed that is the cause of your issues?

Martin
Martin

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

JDR04
Posts: 264
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Problem programming Chip

Postby JDR04 » Mon Jun 10, 2013 7:33 pm

OK thanks...........standby.............

JDR04
Posts: 264
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Problem programming Chip

Postby JDR04 » Mon Jun 10, 2013 8:11 pm

Hi Martin, tried all that still not working....