terrydeltasigmacorp.com Posted August 15, 2018 Posted August 15, 2018 If is set a M-Var directly to a real value, does Power PMAC convert it to a 32-bit floating point value. I need to send a 32-bit floating point value out to a piece of equipment using a ACC-14E. If I can set a M-Var equal to the real value, I can then parse it out into 4 8-bit values to write to the ACC-14E. Thanks
curtwilson Posted August 15, 2018 Posted August 15, 2018 I think you will need a small trick here. First, you will write your value to a holding register in the user shared memory buffer as a 32-bit floating-point value. For example, Sys.Fdata[100] = MyValue Then you can access the 4 bytes in this representation individually with Cdata elements: Sys.Cdata[400] Sys.Cdata[401] Sys.Cdata[402] Sys.Cdata[403] Note that since there are 4 Cdata elements per Fdata element, the indices are 4 times greater. So these can simply be copied a byte at a time to the 4 byte registers of your ACC-14E: Acc14E.DataReg[0] = Sys.Cdata[400] etc.
Recommended Posts