mtconnect / adapter

MTConnect adapter framework
90 stars 73 forks source link

Large Part Counter Values with Fanuc Adapter #1

Open jabbassian opened 12 years ago

jabbassian commented 12 years ago

Large part counter values that exceed 32768 are not reported properly. If the part count is <=32768 then it reports the correct value. For example, if the Fanuc CNC's part counter is set for 32769 for example then the value that is returned is -32767.

Thanks,

Jim Abbassian & David Smither

ellisware commented 10 years ago

I believe the issue may be line 392. The type of data read from the IODBPSD structure is 'short' which is 16 bits = +/- 32768 as a maximum. By changing it to...

void FanucAdapter::getCounts(){ .... mPartCount.setValue(buf.u.ldata); //old = mPartCount.setValue(buf.u.idata); .... }

The maximum parts count becomes = +/- ((2^32)/2). The change should cascade fine as 'int' is accepted by IntEvent::setValue();

wsobel commented 10 years ago

Thanks, I’ll make the change and check it in..

On Jul 31, 2014, at 2:34 PM, Mike Ellis notifications@github.com wrote:

I believe the issue may be line 392. The type of data read from the IODBPSD structure is 'short' which is 16 bits = +/- 32768 as a maximum. By changing it to...

void FanucAdapter::getCounts(){ .... mPartCount.setValue(buf.u.ldata); //old = mPartCount.setValue(buf.u.idata); .... }

The maximum parts count becomes = +/- ((2^32)/2). The change should cascade fine as 'int' is accepted by IntEvent::setValue();

— Reply to this email directly or view it on GitHub.