Heatsink fan controll not go to chip

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
cvanhal
Posts: 23
Joined: Wed Aug 26, 2009 8:51 am
Has thanked: 10 times
Contact:

Heatsink fan controll not go to chip

Post by cvanhal »

i have made an fancontroller in flowcode, after try arround with LCD en LED's read the ADC and return to PWM..

i try all kind of programs stored in the chip and make an try's..

now i make my first real program a controller in flowcode avr v4, combining what i did with the try projects, i try to write the file to the AMTMEGA 32 and it give lot of problems.

in simulationmode the project workes fine, i can really not find what i did i wrong..

is there anyboddy how can look to my file and advise..

iam complete new and have no other experiance than with this flowcode V4 AVR..

Thx for helping.

here i will post my file..
Attachments
LM35-PWM-controll.fcf_avr
heatsing fan controller
(27.55 KiB) Downloaded 306 times

User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: Heatsink fan controll not go to chip

Post by Jan Lichtenbelt »

Dear cvanhal

I started with you program and find some starting problems:
1) Init_count in the main macro is not initialised. The first step must be something like: Init_count=0
2) The loop by means of label A, can be easy replaced by a while-statement (this is only cosmetic)
3) The LCD must be started before use with some time delay before ( e.g. 2 msec) the first the first LCD call. That means LCD clear before start is not allowed. This already can be a solution to your problem.

Succes

Jan Lichtenbelt

cvanhal
Posts: 23
Joined: Wed Aug 26, 2009 8:51 am
Has thanked: 10 times
Contact:

Re: Heatsink fan controll not go to chip

Post by cvanhal »

Thanks Jan for helping me along..

I will try to figureout he comments when aim not succeed i will post again..

I really like the flowcode as i have no experiance with programming only with hardwhare..

Thx

:idea:

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: Heatsink fan controll not go to chip

Post by Benj »

Hello,

Is the problem that the AVR is not being programmed or is it that the program is not running as expected on the device?

AVRs generally come with a /8 configuration word enabled so they usually run 8 times slower then expected. Have you programmed a configuration to the device?

If the device is not programming then it could be a USB driver problem or something similar that is causing this to fail.

Also I have moved your forum topic from the Articles section. Please ensure to post in the relevant section for your query. If you do not have access to the Flowcode v4 forum topic then you can sign up by following the procedure detailed here.

http://www.matrixmultimedia.com/mmforum ... =29&t=6524

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: Heatsink fan controll not go to chip

Post by Benj »

Thax for reaction..

the chip can be programmed i programmed allready PWM flows and bliking LED's value's to an LCD that all goes perfect..

when i start make the program combined as here, and i will sent the file to the Atmega itr say the code cant be writen in the Atmega as one of the c-codes could not be converted???... there is no C-code used in the file as you can see..

thx
The problem with the program is that the int to float function is not recognised by the compiler. AVR handles floating point very well so I have got rid of the float conversion function from your program and simply used the = symbol to assign the integer value to the float variable.

Here is the version of the program that will compile correctly.
Attachments
LM35-PWM-controll.fcf_avr
(27.53 KiB) Downloaded 313 times

cvanhal
Posts: 23
Joined: Wed Aug 26, 2009 8:51 am
Has thanked: 10 times
Contact:

Re: Heatsink fan controll not go to chip

Post by cvanhal »

i have got the file finaly in to the chip. what happends now is that the program hangs on the Overheat loop as the AD is not reacting on 0-5 volt.

I tested the ADC with an simple PWM with ADC combination an that workes fine..

even the LCD is not viewing the information it is printed to even there i did some simple tests and the LCD workes on the chip with the same connections as i use in the fan programm..

i think some things are interfearing with eatchother may be an hint will be helpfull for me..

Thx

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: Heatsink fan controll not go to chip

Post by Benj »

Hello,

A hanging program can normally be troubleshooted quite easily.

1) Are you using any blocking code near where the program is hanging. Eg while loops that are not exiting as expected.

2) Are you running out of RAM memory? You can see this by viewing the memory output as part of the compilation process. If you are trunning out of memory then you may have to try and optimise your program a bit. Your programs did not seem that large so hopefully this is not the case.

3) It is a hardware fault. Eg you might have the watchdog configuration setting enabled or maybe something is causing the device to brown out.

If you cannot find out what is causing the problem then you could use say a FlowKit to troubleshoot the program on the hardware.

cvanhal
Posts: 23
Joined: Wed Aug 26, 2009 8:51 am
Has thanked: 10 times
Contact:

Re: Heatsink fan controll not go to chip

Post by cvanhal »

after an well spend hollyday i go further with the program and thx for helping me on the way.

can you give me an hind where to find the wachdog setting..

greetings..

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: Heatsink fan controll not go to chip

Post by Benj »

Hello,

The watchdog setting is part of the configuration.

Chip -> Configure -> Switch to expert.

cvanhal
Posts: 23
Joined: Wed Aug 26, 2009 8:51 am
Has thanked: 10 times
Contact:

Re: Heatsink fan controll not go to chip

Post by cvanhal »

Benj,
Finaly i found all problems, and got the program working in the Amel chip.

An boost inserted so i know sure the fan start at low PWM level..

Now i want to insert the PID function, i looked to the example on the web site of Matrix multimadia.

I imported the PIC file what i think is that the file is not compatable with flowcode V4 AVR as it wil not work good..

Do you have an file that is compatable with Flowcode V4 AVR so i can have a look at it..

Thx..

here the final file working at the hardware..

greatings and many thx
LM35-PWM-controll-fin.fcf_avr
final working file
(29.56 KiB) Downloaded 316 times

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: Heatsink fan controll not go to chip

Post by Benj »

Hello,

I am currently working on a PID article that should be available shortly. In the mean time the algorithm for PID is as follows.

P * (Error – Prev_Error + (Error / I) + D * (Error – (2 * Prev_Error) + Prev_Prev_Error))

cvanhal
Posts: 23
Joined: Wed Aug 26, 2009 8:51 am
Has thanked: 10 times
Contact:

Re: Heatsink fan controll not go to chip

Post by cvanhal »

OK thx i will give it an try.

THX so much.

i will try and will get your article on PID when you publish it..

Greetings..

cvanhal
Posts: 23
Joined: Wed Aug 26, 2009 8:51 am
Has thanked: 10 times
Contact:

Re: Heatsink fan controll not go to chip

Post by cvanhal »

Good i have over vieuwed the PID flow and understand the alogrithm for the PID..

i have some termology questions..

in the PID sample file is calculation "GAIN SETTINGS" as i understand is tha value the sum of the PID errors an setpoints..

in the sample there are two setpoint values, can you explain why what is teh function.

There is an output what can correspond with an LED what is the function as it is not related to any varabel or action from the PID macro..

In the PID macro there is the ADC(0) sampled what is the meaning of sample in this case?. there is no varable calles or returned???..

when i have these answers i would beable to understand what is happening in the Flow..

Thx
PIDtest-AVR.fcf_avr
the imported PID file
(11.5 KiB) Downloaded 240 times

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: Heatsink fan controll not go to chip

Post by Benj »

Hello,

P,I and D are parameters used to tune the PID response. You must match these values to the characteristics of your system. For a 2nd order system eg a DC motor P and I should have similar values and D should be 1/4 of I.

As for the other bits. Please await my article on Friday which should explain a lot of the tricky parts of applying a PID algorithm.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Heatsink fan controll not go to chip

Post by medelec35 »

Benj wrote: Please await my article on Friday which should explain a lot of the tricky parts of applying a PID algorithm.
I am also looking forward to reading this article. That's another thing that can be crossed of my: Things I want to learn list :)
Martin

Post Reply