Please help with Config Settings

Forum for problems or queries regarding the Flowcode application and compiler usage.

Moderators: Benj, Mods

Post Reply
Borries
Posts: 6
Joined: Wed Jun 18, 2008 9:18 am
Contact:

Please help with Config Settings

Post by Borries »

Hi there

I'm new to Flowcode and I have purchased a Professional Licence.
I'm using Flowcode V3.2.0.36

I used a demo version of Flowcode, V3.???? (can't remember which version). Whilst using the demo, I could configure the Watchdog Timer, Boden, ect... by clicking on Chip->Configure.

I have uninstalled the Demo version, and Installed the Flowcode I received on a CD. I have also installed PPPv3.9. I however don't have a PIC programmer for Flowcode or PPP. I have a Microchip MPLAB ICD 2 programmer.

Now, when I click on Chip->Configure in Flowcode, I get a massive Textbox saying that I can "Enter any required __CONFIG data:". I don't know how to get my settings back to where I can manually "click-and-modify" the CONFIG settings...?

I have uninstalled the new licensed Flowcode, aswell as uninstalling PPPv3.9 and only installed Flowcode again (thinking that removing PPP would rectify this problem), however I still don't get the required result...

Can anyone please tell me how to fix this??

Regards
Borries

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: Please help with Config Settings

Post by Benj »

Hello Borries

PPP is responsible for creating the configuration data. You have two options.

1) You can reinstall PPP and use this to embed the configuration settings into your .Hex files. Then you can use your ICD2 to manually program the hex files.

2) You can browse the forum and the PICmicro datasheets for the correct configuration settings and then use IDC2 directly via Flowcode. There is a topic on PICkit 2 that covers defining the configuration settings.

Borries
Posts: 6
Joined: Wed Jun 18, 2008 9:18 am
Contact:

Re: Please help with Config Settings

Post by Borries »

Benj,

Thank you for your reply...

I have reinstalled PPP and I've retrieved nice Configure screen again :P

Do I then program the hex file to the PIC from Mplab?

Thanx again
Regards\
Borries

Borries
Posts: 6
Joined: Wed Jun 18, 2008 9:18 am
Contact:

Re: Please help with Config Settings

Post by Borries »

Benj,

Sorry, how do you "send" a hex file to the MPLab ICD2??

Regards
Borries

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: Please help with Config Settings

Post by Benj »

Hello Borries

Thats a good question.

If you cannot directly transfer the hex file using an upload tool then you should be able to load the output ASM file into MPLAB and program that way.

Alternatively see this post for setting your own configuration settings.
http://www.matrixmultimedia.com/mmforum ... 2007#p5190

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: Please help with Config Settings

Post by Sean »

Hello Borries

Here is a link to some forum postings regarding PIC programmers. The main topic relates to PICKIT, but several of the postings in the middle of the topic provide a solution for downloading programs directly from Flowcode to a target device using ICD2.

http://www.matrixmultimedia.com/mmforum ... f=5&t=4161

This requires the downloading of a program called PICLAB-PROG from Sourceforge to provide a command line interface for the ICD2.

Details are provided for the creation of a batch file to pass the appropriate parameters directly from Flowcode to PICLAB-PROG, controlling the transfer of the Flowcode hex file to the target device.

Borries
Posts: 6
Joined: Wed Jun 18, 2008 9:18 am
Contact:

Re: Please help with Config Settings

Post by Borries »

Shaun,

Thank you for your help! I have managed to config the PIC by using: :P
0x2007,0xffc

But I'm having lots of troubles with the rest :cry:

Let me explain:
I'm using a 16F630 PIC and I have some experience with ASM.
I'm using RA0, RA1, RA2 and RA5 as digital inputs and RC0, RC1, RC2 and RC3 as digital outputs to switch LED's ON/OFF depending on the inputs on the RA pins. I've coded a ton of 16F630 PIC in ASM that does small LED switching, but I have a nightmare doing it with Flowcode.

The first problem I had, was that RA0 and RA1 would do absolutely nothing when it received a High or Low input. After about 4hours of fiddling with the ASM code that Flowcode produced, I realized that the following was missing:

MOVLW 0x07
MOVWF CMCON ; Configures PortA to digital inputs


So every time I compile a Flowcode Project, I open the ASM file and I then do the Following:
_startup
; Insert this code

MOVLW 0x07
MOVWF CMCON


BCF PCLATH,3
BCF PCLATH,4
GOTO main
ORG 0x000000D5
interrupt
; { interrupt ; function begin

; Delete this code

BCF STATUS, RP0
SWAPF Int1BContext+D'2', W
MOVWF FSR
SWAPF Int1BContext+D'1', W
MOVWF PCLATH
SWAPF Int1BContext, W
MOVWF STATUS
SWAPF Int1Context, F
SWAPF Int1Context, W
RETFIE


; } interrupt function end

ORG 0x00002007
DW 0x0FFC
END


After doing this, I can use the RA0, RA1, RA2 and RA5 inputs.
Is there any way else that I can obtain this result, without having to edit the asm code every time?

Another thing:
Even without fiddling with the ASM code like above, henever I use Time Delays, Goto's and more than 1 loop, the PIC won't perform as planned. For example:
Lets say that I want to set RC0 High for 500ms and then RC1 High for 500ms. While simulating everyting works fine, but when programmed to the PIC, RC1 will never be switched to High.

Can you please help me with what I've just described?

Regards
Borries

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: Please help with Config Settings

Post by Benj »

Hello Borries

Please replace the FCD file in your Flowcode V3/FCD folder for the one included in the attachment. This should fix your initialise problem.

As for your timing problems. Sounds like you have the oscillator configuration configured incorrectly. Under chip -> Configuration make sure you have XTAL selected. Then also set the hardware to XTAL mode by using slide switch SW2. Finally make sure your clock speed matches your crystal frequency in Chip -> Clock speed.

Also make sure you have the watchdog timer disabled in the chip configuration. This would cause the chip to keep resetting eg. half way through a delay.
Attachments
16F630.fcd
(3.7 KiB) Downloaded 361 times

Borries
Posts: 6
Joined: Wed Jun 18, 2008 9:18 am
Contact:

Re: Please help with Config Settings

Post by Borries »

Benj,

Thank you very much for the quick reply....

I have downloaded and replaced the FCD file in my Flowcode V3/FCD folder. However, it did not change anything. I still need to modify the asm code to have inputs on RA0 and RA1. :cry:

Sorry, I didn't tell you. I use the Internal OSC in my application. I program the PIC and then plug it into a homemade test circuit. The Circuit has 5 Input switches and 5 LED's connected to the PIC.

The second problem has been the WDT. Thank you!!!
Loops, delays, ect is working 100%

Just out of curiosity, when wanting to look for analog inputs, what do you use?? Say I want to monitor for a 10hz input from a Windcharger (thus checking at what speed its turning), what will I use?

Thank you very much for the technical support!!
Regards
Borries

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: Please help with Config Settings

Post by Benj »

Hello Borries

Did you restart Flowcode after changing the FCD file. The command cmcon = 0x07; should appear at the top of your Main function if you look at the C code output.

If you wish to use analogue inputs then you would use an ADC component. The hardware macros to sample and read the result can then be called in a timer interrupt or a loop with a delay to acheive your 10hz sample rate.

Borries
Posts: 6
Joined: Wed Jun 18, 2008 9:18 am
Contact:

Re: Please help with Config Settings

Post by Borries »

Benj

I dont know what I wrong did the first time (Flowcode wasn't loaded when I replaced the FCD file), but I have checked the C code and the Asm code, and the cmcom command IS present. I recompiled the project, loaded the Asm file in Mplab, programmed the PIC and everything works perfectly :P

Sorry for the false alarm!!! :oops:

Everything works great, 100%

Thank you also for the info regarding the analogue inputs, when I get closer to such a project and I have difficulties, I may need to press on your button again.

Thank you all at Matrix Mutlimedia for Flowcode!!! I works like a dream, all of the faults where on my side - RTFM problems :roll:

Have a great day and thank you for all your help and time
Regards
Borries

Post Reply