A F 160.0 // Check if f160.0 is 1
JC =M001 //If f160.0=1 then jump to marker m001 (jump conditional)
JU =M002 //Or if f160.0=0 then jump to m002 (jump unconditional)
M001: C DB 193 //Call Data Block 193
AN F 160.1 //Check if f160.1 is 0....
A F 160.2 //Check if f160.2 is 1....
JC =M003 //and jump if both correct
JU =M004 //else jump here
M003: //jumped here if f160.1=0 and f160.2=1
L DW 100 // load data word 100 (of data block 193)
L DW 101 // load data word 101 (of data block 193)
-F //subtract dw101 from dw100...
T DW 100 //put the answer here
L KF +1 //load fixed decimal value of 1
<F //compare if dw100 is less than fixed value 1
= F 160.3 // if dw100 is less than 1 then enable this flag
A F 160.3 //check if f160.3 is 1
JC =M005 //and jump to this marker if true
//program continues here if doesn't do the jump above
M004:// jumped here when either f160.1=1 or f160.2=0
AN F 160.4 // check if f160.4 is 0
JC =M006 // and jump here if true
//program continues here if doesn't do the jump above
M005:// jumps here if m160.3 is 1
L KH 0000 //load zero into accumulator 1
T DW 100 // and transfer accumulator 1 to dw100
M006: AN F 160.1 //jumps here if f160.4=0 and check if f160.1=0
= F 160.2 // if true then enable f160.2
L DW 100 //load dw100 into accumulator 1
L KF +1 //load fixed value 1
<F //check if dw100 is less than 1...
JC =M007 //if true then jump to m007
JU =M002 // if not true then jump here
M007: R F 160.0 // reset flag f160.0
M002:
L DW 100 // load dw100
SLW 4 // shift left word (dw100) 4 places
T PW 128 // transfer to pheriphal word pw128 (analog output)
L DW 100 // load dw100
L DW 104 // load dw104
<F // if dw100 is less than dw104 then..
= F 165.0 // enable f165.0
Bear in mind that the program is scanned top to bottom, and that the jump statements only serve to 'miss out' bits of code, and does not interrupt program flow (in this instance).
From what I can gather, when f160.0=0, then most of this code is ignored and dw100 is loaded straight into the analog output (pw128). Otherwise, dw101 is taken away from dw100 and then put into pw128. The subtraction of dw101 maybe done every cycle, therefore meaning dw100 will get less and less while flag f160.0=1 (slowing something down?). That really depends on where dw100 gets its value from. If a fixed value is loaded into dw100 every scan, then the subtraction will only get done once.
edit..
Sorry I've just read the post again..the actual problem is f165.0 nor being on, so, check the values of dw100 and dw104.
Where does m160.0 come from?