Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: MarkTTU on July 23, 2015, 12:43:25 PM

Title: Signed Analog Inputs?
Post by: MarkTTU on July 23, 2015, 12:43:25 PM
Its been a long time coming, but I'm FINALLY starting on my first real world Do-more project. Trying to wrap my head around the logic behind having analog inputs go into a signed integer location automatically, but not actually be signed...

I have a F2-8AD4DA-1 card. All automagically configured and setup. If I look at WX0 this is what I see for different mA values I send to the card:

0mA = 0
4mA = 13,200
8mA = 26,325
12mA = -26,075
16mA = -12,960
20mA = -1

That sure seems to indicate that the analog card is placing an unsigned value into WX0, but Do-more is interpreting it as signed.

If I do a MapIO and just move all the WX points into V points then all is well and I get 0-65535 as I'd expect. What's odd to me is I don't have to cast the WX points as Unipolar, I can just do a MapIO WX0 -> V0 and it works. If I do explicitly state that WX0 should be cast as unipolar (ie WX0:u -> v0) it works just the same as if I don't cast WX0 as unipolar.

This isn't a show stopper or anything, but it seems really really screwy to me. I would have expected the signed values in WX0 to look more like this:

0mA = -32,767
10mA = 0
20mA = 32,767
Title: Re: Signed Analog Inputs?
Post by: BobO on July 23, 2015, 10:03:04 PM
WX and WY memory are signed. We don't always know what is going on with the analog modules, given that many have jumper configurations. Future platforms won't struggle with such issues. All of the configuration will come from the PLC, and the PLC will "know" how the analog is configured.

In the meantime, it is completely appropriate to cast WX or WY to unipolar. You can actually document WXn:U, and then every time you reference the associated nickname, you will get the cast without having to expressly enter it.