Changes in v5

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times
Contact:

Changes in v5

Post by echase »

Am upgrading this week from v3 to v5 Professional. Due to the A/D being too slow on a 16F690 I want to port the code to a 16bit PIC such as one in the dsPIC30, dsPIC33 or PIC24 ranges as theoretically their A/D is much faster due to 16bit and slightly higher clock speeds. Some questions:-

1) Will it actually speed up the A/D or does Flowcode throttle the speed to the same level as 8bit by the way the code pauses to wait for certain things like sample and hold? I doubled your 690 code speed by changing some of the A/D delays in the 690 file.

2) I also want to use TMR0, 1, 2 a bit more intelligently. On the 690 only the very basic functionality of these timers was implemented by Flowcode so I had to use C Code to extend it. Will this be any better for me now due to v5 upgrade or the files for dsPIC30 etc. being more extensive?

3) I don’t understand what the DSP side of these 16 bit PICs does but does Flowcode enable the DSP functions to be programmed should I choose to use any? I do need to do some analogue processing, e.g. it would be nice to filter the A/D results to certain frequencies if the DSP enabled this.

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: Changes in v5

Post by Benj »

Hello,

Here are some answers to your questions.

1) As standard the v5 ADC component is the same as it always was. We have added extra features in the form of additional functions which allow you to setup the channel in A2D mode and then sample as fast as you can if you wish.

2) in v5 we have put a lot of effort into trying to support all timers, int pins, ioc pins etc on all devices. Simulation of things like timers should also be much better now.

3) v4 did not really support any ds features. We have plans to add these into v5 though I do not know exactly how at the moment. Could be we add a number of additional dsPIC components to do things like filtering, transforms (FFT), vector processing and matrix manipulation etc...

echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times
Contact:

Re: Changes in v5

Post by echase »

Thanks. Very helpful.

On your answer 1, ignoring the A2D mode for the moment, if the PIC components are the same will a PIC24 A/D in v5 sample and convert at the same speed as a 16F690 at the same clock speed in v5? Or will it sample much faster because the pauses, etc. in your component file are shorter, plus it only needs to process in one step to cover a 10 or 12 bit number? I am hoping for a 4-8 times cut in the time by going to PIC24.

The datasheets say there is a fixed time needed, like 10us, to stabilise the A/D when it’s turned from off to on and presumably this is built into your A/D routine. Far as I am aware I leave mine on all the time so this does no apply. Or does Flowcode turn off the A/D after finishing a sample so aways need this 10us on every sample? I don’t use the A/D pins for any other function.

I am getting 60-70us per 10bit sample for a 690 clocked at 20MHz.

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: Changes in v5

Post by Benj »

Hello,

A 8-bit micro can run up to speeds of around 48MHz or 12MIPs. A 16-bit micro such as a PIC24 can run up to 33MIPS and the dsPIC30 devices can run up to 40MIPs.

A MIP is a million instructions per second.

Therefore in answer to your question, yes the device will be faster and so will cut down on setup and execution time and yes the ADC results will take less time to complete. Some devices are tailored to high speed ADC operation so maybe worth having a browse of the datasheets.

The standard legacy Flowcode sample does the following all inside the one function.

Stores digital DDR and Enables ADC Channel
Pre Charges ADC Signal
Performs A2D
Disables ADC Channel and Restores Digital DDR

The additional v5 functions allow you to call each of these sections separately so for example you can now do this.

Store digital DDR and Enable ADC Channel
Pre Charge ADC Signal
Perform A2D
Perform A2D
Perform A2D
Perform A2D
Perform A2D
Perform A2D
etc.

echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times
Contact:

Re: Changes in v5

Post by echase »

That looks promising but not quite clear about the precharge. Surely, as the analogue voltage changes, would I not want to:

Store digital DDR and Enable ADC Channel
Pre Charge ADC Signal
Perform A2D
Pre Charge ADC Signal
Perform A2D
Pre Charge ADC Signal
Perform A2D
Pre Charge ADC Signal
Perform A2D
etc

Or does "Perform A2D" include a topping up of the charge?

Also can I do similar for more than 1 channel like:

Store digital DDR and Enable ADC Channel
Pre Charge ADC Signals
Perform A2D channel 1
Perform A2D channel 2
Perform A2D channel 3
Perform A2D channel 1
Perform A2D channel 2
Perform A2D channel 3
etc
insted of having to repeat the "Store digital DDR and Enable ADC Channel" to change channel?

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: Changes in v5

Post by Benj »

Hello,

When you first enable a ADC channel the charge capacitor is essentially grounded. The pre-charge allows the charge cap to settle at a value approximated to the voltage on the ADC pin and essentially guarantees that ADC voltages do not bleed into each other when sampling multiple channels. Once the pin has been charged you can simply keep sampling the ADC and the capacitor will keep its charge relative to the voltage on the ADC pin.

If you have multiple channels then you will have to sample a channel, disconnect, connect to new channel, precharge and then you can sample the next channel.

echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times
Contact:

Re: Changes in v5

Post by echase »

There are a few PICs with 2 A/D channels e.g. PIC24HJ256GP610A

Or the dsPIC30F4011 has 10-bit Analog-to-Digital Converter (ADC) with four Sample and Hold inputs.

Presumably on these one could sample 2 voltages without going through all this turning off and precharging. Does Flowcode support this kind of A/D or will it turn off and on the A/Ds when switching channel despite the non standard architecture of these A/Ds? Presumably a bit of C Code manipulation could get around this.

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: Changes in v5

Post by Benj »

Hello,

No direct support for multiple ADC peripherals in v5 but it's be fairly simple to control the second channel device using a bit of C code. May even be able to use the v5 Code abstraction to take care of it all for you.

echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times
Contact:

Re: Changes in v5

Post by echase »

I have now bought the upgrade but please can I have the upgrade instructions for V3 to V5 as does not work from Help >> Check for Upgrade like your website says here http://www.matrixmultimedia.com/flowcode_versions.php for v4.

No idea where to enter my new key to download v5.

User avatar
DavidA
Matrix Staff
Posts: 1076
Joined: Fri Apr 23, 2010 2:18 pm
Location: Matrix Multimedia Ltd
Has thanked: 58 times
Been thanked: 258 times
Contact:

Re: Changes in v5

Post by DavidA »

Hello,

That page is for minor patch upgrades (eg v5.0->v5.1).

For major upgrades you will need to download the new installer, if you have received an email with a valid v5 licence then you simply enter the enter last 12 characters of your key into the Flowcode downloads area on the Flowcode main page.

http://www.matrixmultimedia.com/flowcode.php

echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times
Contact:

Re: Changes in v5

Post by echase »

Ah, thank you. I had been using the drop down menu at top of Home page Products >> Flowcode >> For PIC and it just leads to the option to buy a copy. Would be more intuitive if there was a link called “Flowcode Downloads” on top line or at left ,rather than it just appearing half way down one product description page.

Post Reply