diff src/calibrate.asm @ 352:5c6da9fa5cb0

add setpoint change to first sample in CCR mode
author heinrichsweikamp
date Tue, 28 Jul 2015 13:23:09 +0200
parents 653a3ab08062
children aadfe9f2edaf
line wrap: on
line diff
--- a/src/calibrate.asm	Fri Jul 24 14:52:39 2015 +0200
+++ b/src/calibrate.asm	Tue Jul 28 13:23:09 2015 +0200
@@ -399,6 +399,32 @@
         bcf     new_s8_data_available       ; Clear flag
         return                  ; Done.
 
+	global	transmit_setpoint           ; Transmit current setpoint from WREG (in cbar) to external electronics
+transmit_setpoint:
+    btfss   s8_digital          ; S8 Digital?
+    return                      ; No, ignore
+
+    ; Yes, transmit setpoint from WREG
+    movwf   temp2               ; Store setpoint
+    clrf    temp1               ; Chksum
+    movlw   0xAA                ; Start Byte
+    addwf   temp1,F
+    movff   WREG,TXREG2
+    call    rs232_wait_tx2
+
+    movlw   0x60                ; New SP
+    addwf   temp1,F
+    movff   WREG,TXREG2
+    call    rs232_wait_tx2
+
+    movff   temp2,WREG         ; SP in cbar
+    addwf   temp1,F
+    movff   WREG,TXREG2
+    call    rs232_wait_tx2
+
+    movff   temp1,TXREG2                ; Chksum
+    call    rs232_wait_tx2
+    return
 
 
 	END
\ No newline at end of file