Go Down

Topic: Calling a function is SetUp (Read 256 times) previous topic - next topic

jonnygainz

Is it possible to call a function in setup to set parameters for PWM like say period? I want to set parameters in the program using a keypad and LCD display where the LCD is prompting you to input a voltage, and based on this voltage value a frequency will be calculated for constant v/f control of an induction motor. this frequency value will then calculate a CPRD value and then load that into the CPRD register of the Due before the setup is exited. So basically I want to know if I set up the keypad and LCD in the setup before i enable the Channel counter and exit the step up, if i call a function that utilizes the keypad and LCD after they are initialized in the setup if I will be able to use the keypad and LCD.

david_prentice

Yes,   of course you can place function calls wherever you want.

Write down your requirements.
Design your project.

Draw your flow diagram on paper.   Draw arrows to trace the typical flow.
Rinse and repeat until every path behaves how you want it to.

Most apps consist of setup() and loop().    It is pretty obvious from your flow chart which blocks fit into each part.

Likewise.    You could write short sentences in paragraphs.
But program design or Message style is your choice.

David.

Go Up