OK Mayhemers,
This is what I mean by a software "mod", totally meaningless to non-nerds! What follows is the extra software for the electric fan speed to track the opening of the gas valve, but also to run at a minimum setting when the gas valve is fully shut. I did try running without the software with the fan on fully, but the pilot light kept getting blown out and the excess air would most likely cool the boiler. Every thing after a semi-colon is a comment describing the action.
; FAN CONTROL
FAN_CONTROL
; A duty value 64535 to 63535 for the Force Draught Fan ESC is derived from the
; Gas Valve position display value GV_POS, which has the range 0 to 1000.
; FAN duty = 64535 - GV_POS.
; It is done this way to ensure a 1ms pulse is obtained independently of the Gas Valve
; closed signal, which could vary according to the manually adjusted Gas Valve closed setting.
; FAN duty = 64535d - GV_POS.
; Set FAN to 64585d, FC49h. Default 1ms value. It should be 64535d, but the duty
; was 50us too long.
CALL BANK_0_P2
MOVLW H'FC'
MOVWF FAN_H
MOVLW H'49'
MOVWF FAN_L
CALL BANK_2_P2
MOVF GV_POS_H,W ; Pass GV_POS_H into temporary register to avoid corrupting it.
MOVWF SUB_TEMP_H
MOVF GV_POS_L,W ; Pass GV_POS_L into W before subtraction the value from FAN_L.
CALL BANK_0_P2
SUBWF FAN_L,1 ; Subtract the value from FAN_L
BTFSS STATUS,C ; Check for carry-over.
GOTO FAN_A
GOTO FAN_B
FAN_A CALL BANK_2_P2
INCF SUB_TEMP_H,1 ; Increment the next lower column (in arithmetic terms).
FAN_B
CALL BANK_2_P2
MOVF SUB_TEMP_H,W ; Pass GV_POS_H into W before subtraction the value from FAN_H.
CALL BANK_0_P2
SUBWF FAN_H,1 ; Subtract the value of GV_POS_H from FAN_H
; A manually amended speed offset is now subtracted from FAN
; in order to run the Fan even when the Gas Valve is fully shut.
; This offset can be used to ensure that sufficent air is supplied for combustion.
CALL BANK_2_P2
MOVF FAN_OFFSET_H,W ; Pass FAN_OFFSET_H into temporary register to avoid corrupting it.
MOVWF SUB_TEMP_H
MOVF FAN_OFFSET_L,W ; Pass FAN_OFFSET_L into W before subtraction the value from FAN_L.
CALL BANK_0_P2
SUBWF FAN_L,1 ; Subtract the value from FAN_L
BTFSS STATUS,C ; Check for carry-over.
GOTO FAN_OFF_A
GOTO FAN_OFF_B
FAN_OFF_A CALL BANK_2_P2
INCF SUB_TEMP_H,1 ; Increment the next lower column (in arithmetic terms).
FAN_OFF_B CALL BANK_2_P2
MOVF SUB_TEMP_H,W ; Pass FAN_OFFSET_H into W before subtraction the value from FAN_H.
CALL BANK_0_P2
SUBWF FAN_H,1 ; Subtract the value of FAN_OFFSET_H from FAN_H
; DUTY_4 is the interrupt FAN duty version. This is in order to present to the interrupt
; a single source of DUTY rather than picking up a value of FAN part of the way through the
; calculation; this avoids erractic servo movement.
; On start-up the ESC is allowed 3s to initialise at the 1ms PWM setting.
CALL BANK_2_P2 ; Test the ESC initialising flag.
BTFSS C_FLAGS_2,6
GOTO FAN_NORMAL
; Set the DUTY to 64535d, FC17h. FC17h amended to FC4Dh,
; because pulse length on 'scope was 1054us and not 1000.
CALL BANK_3_P2
MOVLW H'FC'
MOVWF DUTY_4_H
MOVLW H'4D'
MOVWF DUTY_4_L
GOTO END_FAN_CONTROL
FAN_NORMAL CALL BANK_0_P2
MOVF FAN_H,W
CALL BANK_3_P2
MOVWF DUTY_4_H
CALL BANK_0_P2
MOVF FAN_L,W
CALL BANK_3_P2
MOVWF DUTY_4_L
; DUTY_4 is now available to control the Fan speed directly proportional
; to the Gas Valve opening - more gas, more air.
END_FAN_CONTROL