I've written a large program(300 rungs so far) and I am running into a problem with binary math. According to the DL05 manual DIVB and MULB says that the inputs must be 16bit and my inputs are 32bit(5 numbers EX 15.000) that's why I am multiplying by 10000 to compensate for the implied decimal places. For most of the program I am using BCD(MULD etc.) I have reached a stopping point because there is not a MULBD selection at all. Here is the formula I need to work out. ((((Time*10000)/Weight)*Error Weight)/10000) = Error time needed for shortage
I have tried POP after a divide to bring the values in the accumulator up to another Vmem but not sure what to do with it. I have tried BCD but the inputs are too large or small(Negative) The process vary's that's why I need resolution to 15.000 and the timer can get as high as 99.99 sec. I have tried to store a Vmem after each mathematical calculation. Nothing adds up to the same as my $2.00 calculator. There is not room for the DL06 or I'd use floating point math. I could change to a Click plc but Id hate to transpose the entire program over this since this is my last hurdle to overcome. Please any suggestions and if possible explain each step so I can understand
Code:
sp0----LDD
K10000
BIN
OUT V2000
SP1----LD TA5(TMRAF)
BIN
OUT V3000
SP1----LDD V3000
MULB V2000
DIVB V2002(Weight)
MULB V2004(Error wt.)
DIVB V2000
OUT V2010(Error time needed)