etisserant@0: FUNCTION WEIGH : WORD (* BCD encoded *) etisserant@0: VAR_INPUT (* "EN" input is used to indicate "scale ready" *) etisserant@0: weigh_command : BOOL; etisserant@0: gross_weight : WORD ; (* BCD encoded *) etisserant@0: tare_weight : INT ; etisserant@0: END_VAR etisserant@0: (* Function Body *) etisserant@0: IF weigh_command THEN etisserant@0: WEIGH := INT_TO_BCD (BCD_TO_INT(gross_weight) - tare_weight); etisserant@0: END_IF ; etisserant@0: etisserant@0: END_FUNCTION (* Implicit "ENO" *)