diff --git a/Common.inc b/Common.inc index 78d14d3..6db865c 100644 --- a/Common.inc +++ b/Common.inc @@ -239,29 +239,6 @@ Set_MCU_Clk_48MHz MACRO setb Flag_Clock_At_48MHz ENDM -Initialize_Adc MACRO - mov REF0CN, #0Ch ;; Set vdd (3.3V) as reference. Enable temp sensor and bias -IF MCU_48MHZ == 0 - mov ADC0CF, #59h ;; ADC clock 2MHz, PGA gain 1 -ELSE - mov ADC0CF, #0B9h ;; ADC clock 2MHz, PGA gain 1 -ENDIF - mov ADC0MX, #10h ;; Select temp sensor input - mov ADC0CN0, #80h ;; ADC enabled - mov ADC0CN1, #01h ;; Common mode buffer enabled -ENDM - -Start_Adc MACRO - mov ADC0CN0, #90h ;; ADC start -ENDM - -Read_Adc_Result MACRO - mov Temp1, ADC0L - mov Temp2, ADC0H -ENDM - -Stop_Adc MACRO -ENDM Set_RPM_Out MACRO ENDM Clear_RPM_Out MACRO diff --git a/targets/A.inc b/targets/A.inc index 0f3bc87..2249b6e 100644 --- a/targets/A.inc +++ b/targets/A.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -90,17 +88,12 @@ A_pwm EQU 0 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + $include (Base.inc) @@ -128,26 +121,3 @@ P2_PUSHPULL EQU (1 SHL DebugPin) P2_SKIP EQU 0FFh -;********************** -; MCU specific macros * -;********************** - - - - -Set_LED_0 MACRO -ENDM -Clear_LED_0 MACRO -ENDM -Set_LED_1 MACRO -ENDM -Clear_LED_1 MACRO -ENDM -Set_LED_2 MACRO -ENDM -Clear_LED_2 MACRO -ENDM -Set_LED_3 MACRO -ENDM -Clear_LED_3 MACRO -ENDM diff --git a/targets/B.inc b/targets/B.inc index 24c9ad4..fb98b7d 100644 --- a/targets/B.inc +++ b/targets/B.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -91,17 +89,12 @@ C_com EQU 0 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + $include (Base.inc) @@ -127,26 +120,3 @@ P2_PUSHPULL EQU (1 SHL DebugPin) P2_SKIP EQU 0FFh -;********************** -; MCU specific macros * -;********************** - - - - -Set_LED_0 MACRO -ENDM -Clear_LED_0 MACRO -ENDM -Set_LED_1 MACRO -ENDM -Clear_LED_1 MACRO -ENDM -Set_LED_2 MACRO -ENDM -Clear_LED_2 MACRO -ENDM -Set_LED_3 MACRO -ENDM -Clear_LED_3 MACRO -ENDM diff --git a/targets/Base.inc b/targets/Base.inc index 8338548..1cd91ac 100644 --- a/targets/Base.inc +++ b/targets/Base.inc @@ -11,23 +11,24 @@ RTX_SKIP EQU P0SKIP ; Set to 1 for SKIP RTX_PIN EQU Rcp_In ; RTX pin +;**** **** **** **** **** +; PWM pin routing and polarity setup +;**** **** **** **** **** +$if NOT CUSTOM_PWM_SETUP - -IF PWM_ACTIVE_HIGH == 1 ; fet active high -pON LIT 'setb' -pOFF LIT 'clr' -ELSE ; fet active low -pON LIT 'clr' -pOFF LIT 'setb' -ENDIF - -IF COMPWM_ACTIVE_HIGH == 1 ; comfet active high -cON LIT 'setb' -cOFF LIT 'clr' -ELSE ; comfet active low -cON LIT 'clr' -cOFF LIT 'setb' +Initialize_Xbar MACRO + mov XBR2, #40h ;; Xbar enabled + mov XBR1, #02h ;; CEX0 and CEX1 routed to pins +IF ESCNO = E_ + All_pwmFETs_off ; For unlocking of HIP2103/4 driver circuits + call wait100ms + AcomFET_on + BcomFET_on + CcomFET_on + call wait1ms + All_comFETs_off ENDIF +ENDM Set_Pwm_Polarity MACRO IF PCA0_POWER_MODULE == PCA0CPM0 @@ -37,6 +38,12 @@ ELSE ENDIF ENDM +$endif + + +;**** **** **** **** **** +; Comparator setup and phase change +;**** **** **** **** **** IF COMP_PORT == 0 CMP_CN0 EQU CMP0CN0 CMP_MD EQU CMP0MD @@ -47,26 +54,11 @@ CMP_MD EQU CMP1MD CMP_MX EQU CMP1MX ENDIF -Initialize_Xbar MACRO - mov XBR2, #40h ;; Xbar enabled - mov XBR1, #02h ;; CEX0 and CEX1 routed to pins -IF ESCNO = E_ - All_pwmFETs_off ; For unlocking of HIP2103/4 driver circuits - call wait100ms - AcomFET_on - BcomFET_on - CcomFET_on - call wait1ms - All_comFETs_off -ENDIF -ENDM - Initialize_Comparator MACRO mov CMP_CN0, #80h ;; Comparator enabled, no hysteresis mov CMP_MD, #00h ;; Comparator response time 100ns ENDM - Read_Comp_Out MACRO mov A, CMP_CN0 ;; Read comparator output IF ESCNO == O_ @@ -90,7 +82,73 @@ Set_Comp_Phase_C MACRO ENDM +;**** **** **** **** **** +; PWM phase change +;**** **** **** **** **** +$if NOT CUSTOM_PWM_PHASE +; All pwm and com pins must be on port 1 +P_ApwmFET EQU P1.A_pwm +P_AcomFET EQU P1.A_com +P_BpwmFET EQU P1.B_pwm +P_BcomFET EQU P1.B_com +P_CpwmFET EQU P1.C_pwm +P_CcomFET EQU P1.C_com + +Set_Pwm_A MACRO +IF FETON_DELAY == 0 + cON P_AcomFET + mov P1SKIP, #(NOT (1 SHL A_pwm)) +ELSE + mov P1SKIP, #(NOT ((1 SHL A_pwm) + (1 SHL A_com))) +ENDIF +ENDM + +Set_Pwm_B MACRO +IF FETON_DELAY == 0 + cON P_BcomFET + mov P1SKIP, #(NOT (1 SHL B_pwm)) +ELSE + mov P1SKIP, #(NOT ((1 SHL B_pwm) + (1 SHL B_com))) +ENDIF +ENDM + +Set_Pwm_C MACRO +IF FETON_DELAY == 0 + cON P_CcomFET + mov P1SKIP, #(NOT (1 SHL C_pwm)) +ELSE + mov P1SKIP, #(NOT ((1 SHL C_pwm) + (1 SHL C_com))) +ENDIF +ENDM + +Set_Pwms_Off MACRO + mov P1SKIP, #0FFh +ENDM + +$endif + + +;**** **** **** **** **** +; Fets on/off toggling +;**** **** **** **** **** +$if NOT CUSTOM_FET_TOGGLING + +IF PWM_ACTIVE_HIGH == 1 ; fet active high +pON LIT 'setb' +pOFF LIT 'clr' +ELSE ; fet active low +pON LIT 'clr' +pOFF LIT 'setb' +ENDIF + +IF COMPWM_ACTIVE_HIGH == 1 ; comfet active high +cON LIT 'setb' +cOFF LIT 'clr' +ELSE ; comfet active low +cON LIT 'clr' +cOFF LIT 'setb' +ENDIF ApwmFET_on MACRO pON P_ApwmFET @@ -170,38 +228,58 @@ All_comFETs_Off MACRO CcomFET_off ENDM +$endif -IF ALL_FETS_ON_PORT1 == 1 -Set_Pwm_A MACRO -IF FETON_DELAY == 0 - cON P_AcomFET - mov P1SKIP, #(NOT (1 SHL A_pwm)) -ELSE - mov P1SKIP, #(NOT ((1 SHL A_pwm) + (1 SHL A_com))) -ENDIF +$if NOT CUSTOM_LED + +Set_LED_0 MACRO +ENDM +Clear_LED_0 MACRO +ENDM +Set_LED_1 MACRO +ENDM +Clear_LED_1 MACRO +ENDM +Set_LED_2 MACRO +ENDM +Clear_LED_2 MACRO +ENDM +Set_LED_3 MACRO +ENDM +Clear_LED_3 MACRO ENDM -Set_Pwm_B MACRO -IF FETON_DELAY == 0 - cON P_BcomFET - mov P1SKIP, #(NOT (1 SHL B_pwm)) +$endif + +;**** **** **** **** **** +; ADC and temperature measurement +;**** **** **** **** **** +TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) +TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC + +Initialize_Adc MACRO + mov REF0CN, #0Ch ;; Set vdd (3.3V) as reference. Enable temp sensor and bias +IF MCU_48MHZ == 0 + mov ADC0CF, #59h ;; ADC clock 2MHz, PGA gain 1 ELSE - mov P1SKIP, #(NOT ((1 SHL B_pwm) + (1 SHL B_com))) + mov ADC0CF, #0B9h ;; ADC clock 2MHz, PGA gain 1 ENDIF + mov ADC0MX, #10h ;; Select temp sensor input + mov ADC0CN0, #80h ;; ADC enabled + mov ADC0CN1, #01h ;; Common mode buffer enabled ENDM -Set_Pwm_C MACRO -IF FETON_DELAY == 0 - cON P_CcomFET - mov P1SKIP, #(NOT (1 SHL C_pwm)) -ELSE - mov P1SKIP, #(NOT ((1 SHL C_pwm) + (1 SHL C_com))) -ENDIF +Start_Adc MACRO + mov ADC0CN0, #90h ;; ADC start ENDM -Set_Pwms_Off MACRO - mov P1SKIP, #0FFh +Read_Adc_Result MACRO + mov Temp1, ADC0L + mov Temp2, ADC0H ENDM -ENDIF +Stop_Adc MACRO +ENDM + + diff --git a/targets/C.inc b/targets/C.inc index 143ac02..9decceb 100644 --- a/targets/C.inc +++ b/targets/C.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -102,7 +100,7 @@ P_CcomFET EQU P1.C_com ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 0 +$set(CUSTOM_PWM_PHASE) $include (Base.inc) @@ -161,26 +159,3 @@ P2_PUSHPULL EQU (1 SHL DebugPin) P2_SKIP EQU 0FFh -;********************** -; MCU specific macros * -;********************** - - - - -Set_LED_0 MACRO -ENDM -Clear_LED_0 MACRO -ENDM -Set_LED_1 MACRO -ENDM -Clear_LED_1 MACRO -ENDM -Set_LED_2 MACRO -ENDM -Clear_LED_2 MACRO -ENDM -Set_LED_3 MACRO -ENDM -Clear_LED_3 MACRO -ENDM diff --git a/targets/D.inc b/targets/D.inc index 5261922..5ce8dd7 100644 --- a/targets/D.inc +++ b/targets/D.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -90,17 +88,12 @@ A_pwm EQU 0 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + $include (Base.inc) @@ -126,26 +119,3 @@ P2_PUSHPULL EQU (1 SHL DebugPin) P2_SKIP EQU 0FFh -;********************** -; MCU specific macros * -;********************** - - - - -Set_LED_0 MACRO -ENDM -Clear_LED_0 MACRO -ENDM -Set_LED_1 MACRO -ENDM -Clear_LED_1 MACRO -ENDM -Set_LED_2 MACRO -ENDM -Clear_LED_2 MACRO -ENDM -Set_LED_3 MACRO -ENDM -Clear_LED_3 MACRO -ENDM diff --git a/targets/E.inc b/targets/E.inc index 32835b0..795453f 100644 --- a/targets/E.inc +++ b/targets/E.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -90,17 +88,13 @@ A_pwm EQU 0 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + +$set(CUSTOM_LED) $include (Base.inc) diff --git a/targets/F.inc b/targets/F.inc index 31fbe91..ea9e853 100644 --- a/targets/F.inc +++ b/targets/F.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -90,17 +88,12 @@ A_pwm EQU 0 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + $include (Base.inc) @@ -126,26 +119,3 @@ P2_PUSHPULL EQU (1 SHL DebugPin) P2_SKIP EQU 0FFh -;********************** -; MCU specific macros * -;********************** - - - - -Set_LED_0 MACRO -ENDM -Clear_LED_0 MACRO -ENDM -Set_LED_1 MACRO -ENDM -Clear_LED_1 MACRO -ENDM -Set_LED_2 MACRO -ENDM -Clear_LED_2 MACRO -ENDM -Set_LED_3 MACRO -ENDM -Clear_LED_3 MACRO -ENDM diff --git a/targets/G.inc b/targets/G.inc index 579cd2a..1c44b11 100644 --- a/targets/G.inc +++ b/targets/G.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -90,17 +88,12 @@ A_pwm EQU 0 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + $include (Base.inc) @@ -126,26 +119,3 @@ P2_PUSHPULL EQU (1 SHL DebugPin) P2_SKIP EQU 0FFh -;********************** -; MCU specific macros * -;********************** - - - - -Set_LED_0 MACRO -ENDM -Clear_LED_0 MACRO -ENDM -Set_LED_1 MACRO -ENDM -Clear_LED_1 MACRO -ENDM -Set_LED_2 MACRO -ENDM -Clear_LED_2 MACRO -ENDM -Set_LED_3 MACRO -ENDM -Clear_LED_3 MACRO -ENDM diff --git a/targets/H.inc b/targets/H.inc index 5d1a636..395a9ab 100644 --- a/targets/H.inc +++ b/targets/H.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -91,17 +89,12 @@ C_com EQU 0 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + $include (Base.inc) @@ -127,26 +120,3 @@ P2_PUSHPULL EQU (1 SHL DebugPin) P2_SKIP EQU 0FFh -;********************** -; MCU specific macros * -;********************** - - - - -Set_LED_0 MACRO -ENDM -Clear_LED_0 MACRO -ENDM -Set_LED_1 MACRO -ENDM -Clear_LED_1 MACRO -ENDM -Set_LED_2 MACRO -ENDM -Clear_LED_2 MACRO -ENDM -Set_LED_3 MACRO -ENDM -Clear_LED_3 MACRO -ENDM diff --git a/targets/I.inc b/targets/I.inc index 0cca726..6472332 100644 --- a/targets/I.inc +++ b/targets/I.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -89,17 +87,12 @@ C_pwm EQU 0 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + $include (Base.inc) @@ -123,26 +116,3 @@ P2_PUSHPULL EQU (1 SHL DebugPin) P2_SKIP EQU 0FFh -;********************** -; MCU specific macros * -;********************** - - - - -Set_LED_0 MACRO -ENDM -Clear_LED_0 MACRO -ENDM -Set_LED_1 MACRO -ENDM -Clear_LED_1 MACRO -ENDM -Set_LED_2 MACRO -ENDM -Clear_LED_2 MACRO -ENDM -Set_LED_3 MACRO -ENDM -Clear_LED_3 MACRO -ENDM diff --git a/targets/J.inc b/targets/J.inc index 36f64ee..b280e9b 100644 --- a/targets/J.inc +++ b/targets/J.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -89,17 +87,13 @@ A_pwm EQU 0 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + +$set(CUSTOM_LED) $include (Base.inc) @@ -125,9 +119,6 @@ P2_SKIP EQU 0FFh ; MCU specific macros * ;********************** - - - Set_LED_0 MACRO clr P0.LED_0 ENDM diff --git a/targets/K.inc b/targets/K.inc index 1ad0801..d20ef98 100644 --- a/targets/K.inc +++ b/targets/K.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -90,17 +88,12 @@ A_com EQU 0 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + $include (Base.inc) @@ -126,26 +119,3 @@ P2_PUSHPULL EQU (1 SHL DebugPin) P2_SKIP EQU 0FFh -;********************** -; MCU specific macros * -;********************** - - - - -Set_LED_0 MACRO -ENDM -Clear_LED_0 MACRO -ENDM -Set_LED_1 MACRO -ENDM -Clear_LED_1 MACRO -ENDM -Set_LED_2 MACRO -ENDM -Clear_LED_2 MACRO -ENDM -Set_LED_3 MACRO -ENDM -Clear_LED_3 MACRO -ENDM diff --git a/targets/L.inc b/targets/L.inc index 3a9b805..fb77399 100644 --- a/targets/L.inc +++ b/targets/L.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -89,17 +87,12 @@ C_pwm EQU 0 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + $include (Base.inc) @@ -121,26 +114,3 @@ P2_PUSHPULL EQU (1 SHL DebugPin) P2_SKIP EQU 0FFh -;********************** -; MCU specific macros * -;********************** - - - - -Set_LED_0 MACRO -ENDM -Clear_LED_0 MACRO -ENDM -Set_LED_1 MACRO -ENDM -Clear_LED_1 MACRO -ENDM -Set_LED_2 MACRO -ENDM -Clear_LED_2 MACRO -ENDM -Set_LED_3 MACRO -ENDM -Clear_LED_3 MACRO -ENDM diff --git a/targets/M.inc b/targets/M.inc index da0240a..7e6831f 100644 --- a/targets/M.inc +++ b/targets/M.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -92,17 +90,13 @@ A_pwm EQU 1 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + +$set(CUSTOM_LED) $include (Base.inc) diff --git a/targets/N.inc b/targets/N.inc index a966f3b..117800f 100644 --- a/targets/N.inc +++ b/targets/N.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -91,17 +89,12 @@ A_com EQU 0 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + $include (Base.inc) @@ -127,26 +120,3 @@ P2_PUSHPULL EQU (1 SHL DebugPin) P2_SKIP EQU 0FFh -;********************** -; MCU specific macros * -;********************** - - - - -Set_LED_0 MACRO -ENDM -Clear_LED_0 MACRO -ENDM -Set_LED_1 MACRO -ENDM -Clear_LED_1 MACRO -ENDM -Set_LED_2 MACRO -ENDM -Clear_LED_2 MACRO -ENDM -Set_LED_3 MACRO -ENDM -Clear_LED_3 MACRO -ENDM diff --git a/targets/O.inc b/targets/O.inc index 825e03e..a44fcee 100644 --- a/targets/O.inc +++ b/targets/O.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -90,17 +88,12 @@ A_pwm EQU 0 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + $include (Base.inc) @@ -124,26 +117,3 @@ P2_PUSHPULL EQU (1 SHL DebugPin) P2_SKIP EQU 0FFh -;********************** -; MCU specific macros * -;********************** - - - - -Set_LED_0 MACRO -ENDM -Clear_LED_0 MACRO -ENDM -Set_LED_1 MACRO -ENDM -Clear_LED_1 MACRO -ENDM -Set_LED_2 MACRO -ENDM -Clear_LED_2 MACRO -ENDM -Set_LED_3 MACRO -ENDM -Clear_LED_3 MACRO -ENDM diff --git a/targets/P.inc b/targets/P.inc index 2d20044..dc54d12 100644 --- a/targets/P.inc +++ b/targets/P.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -92,17 +90,12 @@ A_pwm EQU 1 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + $include (Base.inc) @@ -128,26 +121,3 @@ P2_PUSHPULL EQU (1 SHL DebugPin) P2_SKIP EQU 0FFh -;********************** -; MCU specific macros * -;********************** - - - - -Set_LED_0 MACRO -ENDM -Clear_LED_0 MACRO -ENDM -Set_LED_1 MACRO -ENDM -Clear_LED_1 MACRO -ENDM -Set_LED_2 MACRO -ENDM -Clear_LED_2 MACRO -ENDM -Set_LED_3 MACRO -ENDM -Clear_LED_3 MACRO -ENDM diff --git a/targets/Q.inc b/targets/Q.inc index b2fcd3e..d7e93a9 100644 --- a/targets/Q.inc +++ b/targets/Q.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -102,7 +100,7 @@ P_CcomFET EQU P1.C_com ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 1 -ALL_FETS_ON_PORT1 EQU 0 +$set(CUSTOM_PWM_PHASE, CUSTOM_LED) $include (Base.inc) diff --git a/targets/R.inc b/targets/R.inc index 6a1566d..dd0ed48 100644 --- a/targets/R.inc +++ b/targets/R.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -89,17 +87,12 @@ C_pwm EQU 0 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + $include (Base.inc) @@ -125,26 +118,3 @@ P2_PUSHPULL EQU (1 SHL DebugPin) P2_SKIP EQU 0FFh -;********************** -; MCU specific macros * -;********************** - - - - -Set_LED_0 MACRO -ENDM -Clear_LED_0 MACRO -ENDM -Set_LED_1 MACRO -ENDM -Clear_LED_1 MACRO -ENDM -Set_LED_2 MACRO -ENDM -Clear_LED_2 MACRO -ENDM -Set_LED_3 MACRO -ENDM -Clear_LED_3 MACRO -ENDM diff --git a/targets/S.inc b/targets/S.inc index fb8f200..3e954a6 100644 --- a/targets/S.inc +++ b/targets/S.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -89,17 +87,12 @@ A_com EQU 0 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + $include (Base.inc) @@ -125,26 +118,3 @@ P2_PUSHPULL EQU (1 SHL DebugPin) P2_SKIP EQU 0FFh -;********************** -; MCU specific macros * -;********************** - - - - -Set_LED_0 MACRO -ENDM -Clear_LED_0 MACRO -ENDM -Set_LED_1 MACRO -ENDM -Clear_LED_1 MACRO -ENDM -Set_LED_2 MACRO -ENDM -Clear_LED_2 MACRO -ENDM -Set_LED_3 MACRO -ENDM -Clear_LED_3 MACRO -ENDM diff --git a/targets/T.inc b/targets/T.inc index 2da73d3..1fe5de6 100644 --- a/targets/T.inc +++ b/targets/T.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -91,17 +89,12 @@ C_com EQU 0 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + $include (Base.inc) @@ -127,26 +120,3 @@ P2_PUSHPULL EQU (1 SHL DebugPin) P2_SKIP EQU 0FFh -;********************** -; MCU specific macros * -;********************** - - - - -Set_LED_0 MACRO -ENDM -Clear_LED_0 MACRO -ENDM -Set_LED_1 MACRO -ENDM -Clear_LED_1 MACRO -ENDM -Set_LED_2 MACRO -ENDM -Clear_LED_2 MACRO -ENDM -Set_LED_3 MACRO -ENDM -Clear_LED_3 MACRO -ENDM diff --git a/targets/U.inc b/targets/U.inc index 17368ed..dc7994c 100644 --- a/targets/U.inc +++ b/targets/U.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -92,17 +90,13 @@ A_pwm EQU 1 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + +$set(CUSTOM_LED) $include (Base.inc) diff --git a/targets/V.inc b/targets/V.inc index fca1bcb..08f21cd 100644 --- a/targets/V.inc +++ b/targets/V.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -102,7 +100,7 @@ P_CcomFET EQU P0.C_com ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 0 +$set(CUSTOM_PWM_PHASE) $include (Base.inc) @@ -161,26 +159,3 @@ P2_PUSHPULL EQU (1 SHL DebugPin) P2_SKIP EQU 0FFh -;********************** -; MCU specific macros * -;********************** - - - - -Set_LED_0 MACRO -ENDM -Clear_LED_0 MACRO -ENDM -Set_LED_1 MACRO -ENDM -Clear_LED_1 MACRO -ENDM -Set_LED_2 MACRO -ENDM -Clear_LED_2 MACRO -ENDM -Set_LED_3 MACRO -ENDM -Clear_LED_3 MACRO -ENDM diff --git a/targets/W.inc b/targets/W.inc index 813d2fd..78b0581 100644 --- a/targets/W.inc +++ b/targets/W.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC ;**** **** **** **** **** ; Bootloader definitions diff --git a/targets/Z.inc b/targets/Z.inc index 59d53d7..7f8a29b 100644 --- a/targets/Z.inc +++ b/targets/Z.inc @@ -27,8 +27,6 @@ ; ;**** **** **** **** **** -TEMP_LIMIT EQU 49 ; Temperature measurement ADC value for which main motor power is limited at 80degC (low byte, assuming high byte is 1) -TEMP_LIMIT_STEP EQU 9 ; Temperature measurement ADC value increment for another 10degC @@ -90,17 +88,12 @@ A_com EQU 0 ;o -P_ApwmFET EQU P1.A_pwm -P_AcomFET EQU P1.A_com -P_BpwmFET EQU P1.B_pwm -P_BcomFET EQU P1.B_com -P_CpwmFET EQU P1.C_pwm -P_CcomFET EQU P1.C_com + ; Note: currently all comparator pins (Comp_ and Mux_) must be on the same port COMP_PORT EQU 0 -ALL_FETS_ON_PORT1 EQU 1 + $include (Base.inc) @@ -125,26 +118,3 @@ P2_DIGITAL EQU (1 SHL DebugPin) P2_PUSHPULL EQU (1 SHL DebugPin) P2_SKIP EQU 0FFh - -;********************** -; MCU specific macros * -;********************** - - - -Set_LED_0 MACRO -ENDM -Clear_LED_0 MACRO -ENDM -Set_LED_1 MACRO -ENDM -Clear_LED_1 MACRO -ENDM -Set_LED_2 MACRO -ENDM -Clear_LED_2 MACRO -ENDM -Set_LED_3 MACRO -ENDM -Clear_LED_3 MACRO -ENDM