Page 1 of 1

Heatsink fan controll not go to chip

Posted: Wed Feb 16, 2011 4:42 pm
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..

Re: Heatsink fan controll not go to chip

Posted: Sat Feb 19, 2011 12:51 pm
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

Re: Heatsink fan controll not go to chip

Posted: Sat Feb 19, 2011 3:39 pm
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:

Re: Heatsink fan controll not go to chip

Posted: Fri Feb 25, 2011 9:24 am
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

Re: Heatsink fan controll not go to chip

Posted: Fri Feb 25, 2011 11:04 am
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.

Re: Heatsink fan controll not go to chip

Posted: Fri Feb 25, 2011 2:59 pm
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

Re: Heatsink fan controll not go to chip

Posted: Fri Feb 25, 2011 3:20 pm
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.

Re: Heatsink fan controll not go to chip

Posted: Thu Mar 24, 2011 7:32 pm
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..

Re: Heatsink fan controll not go to chip

Posted: Fri Mar 25, 2011 12:31 pm
by Benj
Hello,

The watchdog setting is part of the configuration.

Chip -> Configure -> Switch to expert.

Re: Heatsink fan controll not go to chip

Posted: Sat Mar 26, 2011 8:30 pm
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 387 times

Re: Heatsink fan controll not go to chip

Posted: Mon Mar 28, 2011 10:47 am
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))

Re: Heatsink fan controll not go to chip

Posted: Mon Mar 28, 2011 11:34 am
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..

Re: Heatsink fan controll not go to chip

Posted: Wed Mar 30, 2011 12:12 pm
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 305 times

Re: Heatsink fan controll not go to chip

Posted: Wed Mar 30, 2011 3:11 pm
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.

Re: Heatsink fan controll not go to chip

Posted: Wed Mar 30, 2011 7:48 pm
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 :)