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

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

Problem programming Chip

Postby JDR04 » Thu Jun 06, 2013 8:14 pm

Hi Folks, I have done a simple program that flashes two LED's alternatively. It seems to work great in the simulation.

My first problem is I can no longer see the IC (PIC16F690) on the screen. Somehow I have turned that option off and do not know how to get it back.

My second problem is that I cant seem to download the program into the kit.

I get the following message

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

I'm using a Pickit2 with the low pin count board with a PIC16F690.

I'm also using FLOWCODE5 pro version.

Youre help will be greatly appreciated.
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 » Thu Jun 06, 2013 8:20 pm

HI
goto view and select chip view that should bring the chip back
can you post your flowchart.fcf flowchart C and flowchart.msg.txt files as someone can look over it to see if theres an issue

Regards
Dazz
These users thanked the author dazz for the post:
JDR04 (Thu Jun 06, 2013 9:10 pm)
Rating: 5.26%
 
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

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 » Thu Jun 06, 2013 8:32 pm

Hi Dazz, thanks for the prompt reply. Heres the stuff you asked for.

Have also spotted the following messages;

PICkit 2 found with Operating System v2.30.01

"Use -D to download minimum required OS v2.32.00 or later"

""Return code = 11

"Flowcode was unable to compile the flowchart's C code due to the following errors:"

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


"Don't know what it all means but maybe somebody out there can help."

Thanks again JDR04
Attachments
agitator servo 1.c
(3.43 KiB) Downloaded 81 times
agitator servo 1.fcf
(8 KiB) Downloaded 88 times
agitator servo 1.msg.txt
(872 Bytes) Downloaded 82 times

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 » Thu Jun 06, 2013 9:46 pm

Hi
Looks like you need to upgrade your pickits firmware, chapter 4 in your pickit user guide details how to do it,
so upgrade the firmware, try programming again after and let us know how it goes
Regards
Dazz
These users thanked the author dazz for the post:
JDR04 (Fri Jun 07, 2013 12:25 am)
Rating: 5.26%
 
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

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 » Thu Jun 06, 2013 10:58 pm

Thanks Dazz, I'll give that a try. Dont understand how a month or so agao it all worked fine but now there is a proble.

Anyway, I'll see if I can update the PICKit2 and try again. 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 » Thu Jun 06, 2013 11:19 pm

Downloaded latest PIKit2 software, v2.61. Restarted laptop and tried programming again but to no avail. Same error messages. Also tried programs that were working a little over a month agao and got the same error messages.

Evertime I go to use this Flowcode there is one problem or another. Getting really frustrated with this as I am new to this and when something keeps going wrong its frustrating as I do not understand the messages and what they mean.

Anyway thats my small rant so hoping somebody out there can help.

Thanks guys-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 » Thu Jun 06, 2013 11:32 pm

OK, we seem to be getting somewhere now. Flowcode messages are all good. Ccompiling to Hex says its all good.

Compile to chip also says its good. But...................................the LEDs do not flash at all!!!

Any help out there please. JDR04

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 » Thu Jun 06, 2013 11:34 pm

The PICkit2 programmer requires different firmware for different chips. This is not a flowcode issue, it has to do with the programmer you're using.

When using PICkit2 I prefer to use it in combination with MPlab IDE 8.xx. This work flow requires a few more steps because flowcode is not calling the programmer directly, but side steps the issues of having to think about PICkit2 code updates.

The way I use MPlab to program the devices is:
- In flowcode use 'Compile to HEX' (just left of the chip icon), not 'Compile to chip'
- Open MPlab IDE.
- Choose the correct chip in the 'Configure' - 'Select Device' menu.
- Select PICkit2 in the 'Programmer' - 'Select programmer' menu.
- Load the hex file in the 'File' - 'Import' menu.
- Program the device in 'Programmer' - 'Program' menu.

If you keep MPlab open it will automatically detect newer HEX files, so after modifying your code you just need to use the first and last step to program the device. For most circuits I remove power before connecting PICkit2 and remove PICkit2 after programming before applying power.

Hope this helps...
These users thanked the author kersing for the post:
JDR04 (Fri Jun 07, 2013 12:24 am)
Rating: 5.26%
 
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

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 » Thu Jun 06, 2013 11:43 pm

JDR04 wrote:Compile to chip also says its good. But...................................the LEDs do not flash at all!!!


Have you set the chip configuration? (Project options, TAB 'General Options' use button 'Configure chip')
You need to set at least 'Watchdog timer' to 'OFF'. Depending on your circuit you might need to set 'Master Clear Enable' to 'Internal' (Not needed if you have connected a pull-up to pin 4).
I would also set 'Brown Out Detect' to 'BOD and SBOREN disabled'. Specify the correct option for the oscillator you are using.

Also make sure to set the clock speed in the General Options to the correct value, depending on the oscillator setup being used. The value is used to calculate the timing of the delay statements...
These users thanked the author kersing for the post:
JDR04 (Thu Jun 06, 2013 11:53 pm)
Rating: 5.26%
 
“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 » Thu Jun 06, 2013 11:53 pm

Thanks Kersing, I'll give it all a try and get back to you guys. 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 » Fri Jun 07, 2013 12:05 am

Hi Kersing, tried all that but LEDs still not flashing.
How do I determine the correct clock speed? I bought FLOWCODE thinking it would enable be to program microchips easily without having to mess around with more than one program.

The first time I used FLOWCODE I had a few problems that were easily sorted out with the help of various forum members. This time I'm having more problems in trying to get to grips with it all. Really did think FLOWCODE would make it easier for me but so far I'm struggling to work for me. Hopefully the next time I use it there are no further problems which require more settings and messing about.

Anyway, can you help any further please, I do appreciate your guys time and patience. 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 » Fri Jun 07, 2013 8:34 am

hi
you determine the clock speed according to the xtal you are using, you also need to match the speed to the config settings. I have also just downloaded the manual for the demo board and the leds appear to be connected to port C so try changing A0 to C0 and A1 to C1
Let us know how you get on


Regards
Dazz
These users thanked the author dazz for the post:
JDR04 (Fri Jun 07, 2013 7:59 pm)
Rating: 5.26%
 
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

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 » Fri Jun 07, 2013 7:59 pm

Hi Dazz, changed the port settings but LED's still not flashing.

I used the PICKit2 software to delete any program in the chip and verified that the chip is empty. I then used FLOWCODE and dowloaded the program into the chip and got a sucesfull message at the end. Also noticed the Busy light on the programmer flickering during the burn operation which seemed to indicate the chip was being programmed by the FLOWCODE software.

Then went back into the PICKit2 software and verified the program is infact in the chip as the memory is no longer blank.

I also used the PICKit2 software to check communications between laptop and programmer and all is OK.

So I take it that the chip is programmed but them pesky LED's will not flash. Any other ideas???

Cheers-JDR04

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 » Fri Jun 07, 2013 8:22 pm

Hi JDR04, If you post the flowchart your now using, then I can take a look at it for you and make adjustments if necessary.

Martin

Edit: I have posted a program for you to try.
You must make sure JP1 And JP2 are connected.
Attachments
agitator servo 2.fcf
(12 KiB) Downloaded 76 times
These users thanked the author medelec35 for the post (total 2):
JDR04 (Fri Jun 07, 2013 9:13 pm) • AbhijitR (Sat Nov 25, 2017 7:49 am)
Rating: 10.53%
 
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 » Fri Jun 07, 2013 9:10 pm

Hi Medelec35, as soon as I can get my laptop back from my wife I will post the program for you. Flowcode is only installed on my laptop and I dont think I'm allowed to install it on my desktop PC which I am now at.

JP1 and JP2 are not at the moment joined so I'll do that. Can you you explain why so I will understand. I do however have JP5 joined. Should JP5 not be joined. Also, must JP1 and JP2 be joined for all further programs??

Thanks again 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 » Fri Jun 07, 2013 9:13 pm

Just checked JP1 and JP2 with my meter and they are already joined. Dont understand why the holes are there??

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 » Fri Jun 07, 2013 9:25 pm

Microchip demo boards often have jumpers connected with a copper trace between the pads with the holes. If you want to use the pin for other purposes you can cut the trace. If at a later point in time you want to re-establish the original connection you can solder a small wire in place or use proper headers and jumpers.

As this board has no crystal you need to set the oscillator setting to internal oscillator, also, add a C code block with

Code: Select all

osccon = 0b01110000;


Set the clock speed in the project options to 8000000 (8 million). Also use the settings I mentioned earlier (Watchdog timer off, BOD and SBOREN disabled)
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

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 » Fri Jun 07, 2013 9:30 pm

What is the voltage on pin 4 when your application should be running? And what is the voltage on pin 1?
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

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 » Fri Jun 07, 2013 9:46 pm

JDR04 wrote:lowcode is only installed on my laptop and I dont think I'm allowed to install it on my desktop PC which I am now at.


You are allowed Flowcode to be installed on more than one PC you own within reason.
See:
viewtopic.php?f=49&t=11248&p=39478&#p39507


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 » Sat Jun 08, 2013 8:48 pm

Hi Kersing, in answer to your question on Pin 1 and Pin 4 voltages, they are both 4.9V as set with the Vdd box in the PICKit2 software.

I tried doing the programming into the chip with Vdd on and off but it does not seems to make any difference. It appears that the chip itself is being programmed because I can wipe out the program memory using the PICKit2 software and then program via Flowcode and then verify it with the PICKit2 software.

Also the red busy light on the programmer flockers as you push the COMPILE TO CHIP button in Flowcode so I'm assuming al;l is well on the Flowcode side of things.

I'd be interested to know which is the programming pin on the PIC16F690 as well.

I've also noticed that the oscillator is set as INTERNAL RC CLOCKOUT. Is this correct?

Hope this helps 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 » Sat Jun 08, 2013 9:17 pm

Hi Martin, tried using the program you posted but had the same problems as in the very begining of all this. I'm going to try and insert the c code bit as Kersing suggested and see what happens.......standby JDR04

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 » Sat Jun 08, 2013 9:19 pm

Hi JDR04,The program i posted has already got osccon set.
I ran it on my hardware before posting it.

Good luck anyway.

Martin
These users thanked the author medelec35 for the post:
JDR04 (Sun Jun 09, 2013 8:24 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 » Sat Jun 08, 2013 9:32 pm

Heres my flowchart up till now..........

Anybody with any ideas out there?????
Attachments
agitator servo 1.fcf
(12 KiB) Downloaded 71 times

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 9:47 pm

I have no doubt the PIC is programmed correctly. So either the program contains an error or something else is wrong.

What are you using to power the circuit?
“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:05 pm

The chip is in the PICKit2 low pin count board. Power is supplied via the programmer itself which is connected to my laptop.

Also I checked pin 19 while the program was been burnt into the ic with my scope and there is definately various signals of about 2V on the pin 19 when the red busy light on the programmer is flickering.