Browse Source

Added user selectable PWM

Stan Janssen 7 years ago
parent
commit
befaf1b1de
1 changed files with 16 additions and 14 deletions
  1. 16 14
      minimalmode3.asm

+ 16 - 14
minimalmode3.asm

@@ -60,7 +60,19 @@ PILOT_9     equ 0D2
 PILOT_6     equ 0B4
 DIODE_OK    equ 0B
 
-CHARGEPWM   equ 3C
+PWM_6A      equ 19
+PWM_7A      equ 1D
+PWM_8A      equ 21
+PWM_9A      equ 25
+PWM_10A     equ 29
+PWM_11A     equ 2D
+PWM_12A     equ 32
+PWM_13A     equ 36
+PWM_14A     equ 3A
+PWM_15A     equ 3E
+PWM_16A     equ 42
+
+CHARGEPWM   equ PWM_8A
 
 start
     ; Initialize Ports                          TRISA
@@ -129,6 +141,7 @@ start
     bcf     PIR1, TMR1IF            
     bsf     T1CON, TMR1ON               ; Start TMR1
     bcf     TRISC, 2                    ; Enable output driver
+
     
 ;    Stroom  Duty Cycle  CCPR1L:CCP1CON<5:4>     CCPR1L      CCP1CON<5:4>
 ;    6       10%         100                     25          0
@@ -189,7 +202,7 @@ connected
     btfsc   PORTC, 1    ; Check if the lock is closed
     goto    lock
     
-    movlw   CHARGEPWM       ; Start offering
+    movlw   CHARGEPWM      ; Start offering
     movwf   CCPR1L
     
     ; Check if the diode is OK
@@ -300,7 +313,7 @@ wait_for_ad_result
     ; Check if diode OK
     movf    ADRES, w            ; Voltage -> W
     sublw   DIODE_OK            ; DIODE_OK - Voltage: moet > 0, STATUS,C = 1
-    btfsc   STATUS, C           ; Skip over this of the STATUS,C = 0
+    btfsc   STATUS, C           ; Skip over this ff the STATUS,C = 0
     retlw   3
     
     ; Otherwise return "0", meaning just go to idle and turn everything off
@@ -348,23 +361,12 @@ delay100
     bsf     T0CON, TMR0ON       ; Start the timer
     goto    delay_wait
 
-
 delay_wait
     btfss   INTCON, TMR0IF       ; Wait for the timer to overflow
     goto    delay_wait
     bcf     T0CON, TMR0ON        ; Stop the timer
     return
 
-delay500
-    movlw   d'5'
-    movwf   DLYCOUNT
-    goto    delay_repeat
-
-delay1000
-    movlw   d'10'
-    movwf   DLYCOUNT
-    goto    delay_repeat
-
 delay2000
     movlw   d'20'
     movwf   DLYCOUNT