Flowcode 4 programming help needed

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

Moderators: Benj, Mods

Post Reply
Klipeti
Posts: 13
Joined: Wed Oct 30, 2013 6:30 am
Has thanked: 1 time

Flowcode 4 programming help needed

Post by Klipeti »

Hello.
I don't have a personally owned copy of Flowcode 4, so I can't use it's forums.

I need to make this kind of program:
http://tinypic.com/view.php?pic=1zh1ily&s=5

However, I am a n00b so I thought that someone could make it for me and explain what is happening? Or atleast give step-by-step guide?

Here are other things needed to be included in program:
• Show voltage's desired value and actual value on screen with the precision of desired voltage's value. When actual voltage isn't equal to desired voltage, instead of it's value screen prints (--).
•Voltage must be controlled between 0V and 4V, with 0,5V steps.
•Voltage is controlled with buttons, not with POT.
•When voltage is measured, error between actual voltage and desired voltage must be must be less than 0,03V.

I don't know much about these terms, some of them are new to me (AD, PWM) and I'm not a pro.
The PWM is connected to 4,7k resistor, which is connected to AD0 and 10u capacitor. Capacitor is connected to ground.

I really need help :( Flowcode is still new to me. If someone helped me out (I'm sure that there are guys who can do this eyes closed and half sleep) I'd really appreciate it.

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: Flowcode 4 programming help needed

Post by Benj »

Hello,

Sounds kind of like an assignment for a course :wink:

If you have a go at working through the problem and then post up what you have got so far then I'm sure we can help to point you back in the right direction.

Klipeti
Posts: 13
Joined: Wed Oct 30, 2013 6:30 am
Has thanked: 1 time

Re: Flowcode 4 programming help needed

Post by Klipeti »

I know how to enable PWM, and adjust it with variables. That's it...
I have attempted, but I can't figure out how is the voltage adjusted, and how it should be stepped in precise steps.

In attached .fcf file I have enabled PWM and adjusting it with variable.
Variable is controlled with buttons A0 and A1. The variable's value 0-255 is shown on LCD. As you can see, it is very far from being like it should be.
LEDs aren't used, but they are there for "D" I/Os.

EDIT: Biggest problem I have is that how to calculate PWM to voltage and how to make it work on steps.
Attachments
my_program.fcf
My program...
(17 KiB) Downloaded 285 times

Klipeti
Posts: 13
Joined: Wed Oct 30, 2013 6:30 am
Has thanked: 1 time

Re: Flowcode 4 programming help needed

Post by Klipeti »

Could someone please help me?
Just please help me out with calculating PWM to voltage and making the stepping.
I found out this formula: Voltage_reference / bits * PWM which is in my case 4 / 255 * PWM_variable, right? This should calculate volts, but how I calculate mV ?

Klipeti
Posts: 13
Joined: Wed Oct 30, 2013 6:30 am
Has thanked: 1 time

Re: Flowcode 4 programming help needed

Post by Klipeti »

So I have been trying to make the program, and I attached my latest attempt.
How accurate is this? Is it right?
Attachments
my_program.fcf
Another attempt.
(18.44 KiB) Downloaded 248 times

Post Reply