This project has moved and is read-only. For the latest updates, please go here.

AnalogInput Read vs ReadRaw / Scale

Feb 8, 2013 at 2:04 AM
Edited Feb 8, 2013 at 2:07 AM
Hi, nice code !

Just a little thing the analog input are not showing correctly when using MF 4.2 because the scale is not set anywhere, you need to set the Scale or use ReadRaw.

You can add the Scale like this in Program.cs after the conditional MF_FRAMEWORK_VERSION_V4_2 of DemoModBus_MF, so it will work as intended in the rest of the demo.
        _analogs = new AnalogInput[6];
        _analogs[5] = new AnalogInput(Cpu.AnalogChannel.ANALOG_5);
        // Stuff to add -->
        for (int i = 0; i <= 5; i++)
            _analogs[i].Scale = 1023;
Will certainly use you this code for my home project,
Feb 8, 2013 at 5:24 AM
Hello Techinfo.
Many thanks for your alert: I corrected the code and soon I'll post the updated version!