Hi,
I write this following program but the C Code doesn't work
LCD display always "48' why ??
Thank
----------------------------------------
//Appel de la Routine Composant
Appel de la Routine Composant:
LCDDisplay(0)::Init
----------------------------------------
----------------------------------------
//Appel de la Routine Composant
Appel de la Routine Composant:
LCDDisplay(0)::Efface
----------------------------------------
----------------------------------------
//Calcul
Calcul:
RANG = 51
TOTO = 3
OUT = 48
----------------------------------------
----------------------------------------
//Boucle
Boucle:
Tant que1
<LOOP>
----------------------------------------
//Code C
Code C:
FCV_OUT = FCV_OUT + 1;
----------------------------------------
----------------------------------------
//Appel de la Routine Composant
Appel de la Routine Composant:
LCDDisplay(0)::Γ‰crit_Num(OUT)
----------------------------------------
----------------------------------------
//Pause
Pause:
1 s
----------------------------------------
----------------------------------------
//Appel de la Routine Composant
Appel de la Routine Composant:
LCDDisplay(0)::Efface
----------------------------------------
</LOOP>
----------------------------------------
C CODE doesn't work with V3
- 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:
The Flowcode simulation will not work as you are using C code to increment the OUT variable. It should work fine on hardware.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
re POW in C Code
Yes Benj,
Thank a lot,It's better using hardware.......
I have a other question :
Is it possible to have the function pow(x,y) in flowcode ??
If i use it I have a message error ?
How can i use X^Y ??
Thank for you replay........
Mike
Thank a lot,It's better using hardware.......
I have a other question :
Is it possible to have the function pow(x,y) in flowcode ??
If i use it I have a message error ?
How can i use X^Y ??
Thank for you replay........
Mike
- 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:
Hello Mike
You can do power calculations as follows.
Create your two variables eg A and B.
Variable A may need to be an Int 16 bit variable to hold the result.
Then assign values to A and B with a calculation icon.
Then create a while loop with "B" in the loop while text box (do not include the brackets). This means that the loop will run while B is greater then 0.
Inside the loop create the following calculation "A = A * A"
Then create another calculation to decrment variable B "B = B - 1"
Hope that this helps.
You can do power calculations as follows.
Create your two variables eg A and B.
Variable A may need to be an Int 16 bit variable to hold the result.
Then assign values to A and B with a calculation icon.
Then create a while loop with "B" in the loop while text box (do not include the brackets). This means that the loop will run while B is greater then 0.
Inside the loop create the following calculation "A = A * A"
Then create another calculation to decrment variable B "B = B - 1"
Hope that this helps.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel