For ADC you have to use a ReadAsVoltage() and use a float type variable to store the ADC value. Your
Code C - [expand] |
1
| if(countdp) |
conditions are outside the
Code C - [expand] |
1
| while(1) |
loop and so it will never execute. Explain how your flowchart has to work? Why external interrupt is used?
**broken link removed**
There is not Float To String macro in Flowcode. You have to write your own FloatToStr() macro which converts float value to string. Pass the string obtained to LCD Print macro. Only then you will get float alue printed on LCD. Print Number macro takes INT as argument so your float value get truncated.
Sir.. Thank you very much for your reply..
I understood the working of ReadAsVoltage. Atcually i used to convert bytes later again converted into normal value. That one also working for only integer values.. Your suggestion is very good for accurate values..
Flowchart:
I used the external interrupt, because
In my project, Initially I find-out zero crossing of voltage(zero crossing detector), when voltage crosses zero timer start to count, it continues until current crosses zero(zcd), Timer stops to count and at the same time external interrupt will activate using zcd raising edge pulse. That external interrupt enters the loop to calculate power factor(PF) using time difference between voltage crossing zero & current crossing zero.
Later stage of the program i mentioned switching of relays for different capacitor switching as per power factor requirement. (PORT C is used).
I would like to maintain power factor(PF) above 0.91(0.92,0.93 etc) & to display same.
But display shows 0.8, 0.9,0.7 (only one digit after decimal point) as i told earlier.
Sir.. Just help me how to display two digit power factor(PF) after decimal point. (I'll do rest of the program, that depends on load, so..).
Please..
Thank you..
Edit: I read the Flowcode