Page 1 of 1

MIAC ANALOGUE INPUT - HELP

Posted: Fri May 16, 2014 4:08 pm
by sabretooth4
Hello All,

I want to use the MIACs Analogue inputs to read a voltage.

Once the required voltage is achieved for the MIAC to turn a relay on

I don't know how to read the voltage through the Miac can anyone help please??

Thank you :D

Re: MIAC ANALOGUE INPUT - HELP

Posted: Sat May 17, 2014 11:29 am
by medelec35
Hi sabretooth4,
Welcome to the Matrix forums.
What Version of Flowcode are you using?

The easiest way is to readAsBytes.
If byte value is odd then result then add1 to result.
Divide result by 2
Then the result will be the result 10 times bigger than the measured voltage.

For example 1.if result ReadAsByte is = 9
9+1 = 10 since 9 is an odd number.
10/2 = 5
Therefore Voltage is = 0.5V

For example 2.if result ReadAsByte is = 210
210/2 = 105
Therefore Voltage is = 10.5V
You can use MOD is determine if odd or even value.

Example
If Byte MOD 2 then Byte is an odd number

You can print result by converting to string.
Then you can make it look more professional.

If you need further assistance, then I can help you create a flowchart.

Martin

Re: MIAC ANALOGUE INPUT - HELP

Posted: Sun May 18, 2014 12:06 pm
by sabretooth4
Hello medelec35,

Thank you for replying and helping me out :)

I am using FC6, i am quite experienced in using Flowcode :) just had an issue as never had to use the analogue inputs.

But what you have said makes perfect sense :) and has helped alot.

Thank you very much :D :D

Re: MIAC ANALOGUE INPUT - HELP

Posted: Sun May 18, 2014 1:54 pm
by medelec35
Your welcome.

Just need to remember that to use the analogue component you don't need to add any analogue inputs as they are already built within the Miac component.
so all you need to do is:
Reading Analogue.png
(73.13 KiB) Downloaded 5218 times
Martin