## MIAC ANALOGUE INPUT - HELP

For MIAC users to discuss projects, applications, and any other issues related to the MIAC unit.

Moderators: Benj, Mods

sabretooth4
Posts: 3
Joined: Fri May 16, 2014 4:04 pm
Has thanked: 1 time
Contact:

### MIAC ANALOGUE INPUT - HELP

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

medelec35
Valued Contributor
Posts: 8812
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2558 times
Been thanked: 3712 times
Contact:

### Re: MIAC ANALOGUE INPUT - HELP

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
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

sabretooth4
Posts: 3
Joined: Fri May 16, 2014 4:04 pm
Has thanked: 1 time
Contact:

### Re: MIAC ANALOGUE INPUT - HELP

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

medelec35
Valued Contributor
Posts: 8812
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2558 times
Been thanked: 3712 times
Contact:

### Re: MIAC ANALOGUE INPUT - HELP

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) Viewed 5202 times

Martin
These users thanked the author medelec35 for the post (total 3):
sabretooth4 (Mon May 19, 2014 8:57 am) • LeighM (Mon May 19, 2014 9:23 am) • KevinH (Fri Aug 08, 2014 11:26 am)
Rating: 15%

Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.