;**** **** **** **** **** ; ; BLHeli program for controlling brushless motors in helicopters and multirotors ; ; Copyright 2011, 2012 Steffen Skaug ; This program is distributed under the terms of the GNU General Public License ; ; This file is part of BLHeli. ; ; BLHeli is free software: you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation, either version 3 of the License, or ; (at your option) any later version. ; ; BLHeli is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with BLHeli. If not, see . ; ;**** **** **** **** **** ; ; Hobbyking UBEC 20A hardware definition file ; ; Notes: ; - On 2S low voltage limiting does not work fully according to spec, as ADC reference drops with sensed voltage ; - High side is slow to go on (10s of us) but fast to go off ; ;**** **** **** **** **** ;********************* ; Device Atmega8A ;********************* .INCLUDE "m8Adef.inc" ;**** **** **** **** **** ; Fuses must be set to external oscillator = 16Mhz ;**** **** **** **** **** ;**** **** **** **** **** ; Constant definitions ;**** **** **** **** **** .ESEG ; EEprom segment .ORG 0x40 Eep_ESC_Layout: .DB "#HK_UBEC_20A# " ; ESC layout tag .ORG 0x50 Eep_ESC_MCU: .DB "#BLHELI#Am8A# " ; Project and MCU tag (16 Bytes) .EQU HIGH_BEC_VOLTAGE = 0 ; Set to 1 or more if high BEC voltage is supported .EQU DAMPED_MODE_ENABLE = 1 ; Set to 1 if fully damped mode is supported .EQU NFETON_DELAY = 7 ; Wait delay from pfets off to nfets on .EQU PFETON_DELAY = 250 ; Wait delay from nfets off to pfets on .EQU ADC_LIMIT_L = 116 ; 51k/220k divider. Power supply measurement ADC value for which motor power is limited (low byte) .EQU ADC_LIMIT_H = 0 ; 51k/220k divider. Power supply measurement ADC value for which motor power is limited (2 MSBs) .EQU TEMP_LIMIT = 122 ; 820/3k3NTC. Temperature measurement ADC value for which main motor power is limited .EQU TEMP_LIMIT_STEP = 11 ; 820/3k3NTC. Temperature measurement ADC value increment for which main motor power is further limited ;**** **** **** **** **** ; ESC specific defaults ;**** **** **** **** **** .EQU DEFAULT_PGM_MAIN_SPOOLUP_TIME = 10 ; Main motor spoolup time .EQU DEFAULT_PGM_MAIN_STARTUP_PWR = 10 ; 1=0.031 2=0.047 3=0.063 4=0.094 5=0.125 6=0.188 7=0.25 8=0.38 9=0.50 10=0.75 11=1.00 12=1.25 13=1.50 .EQU DEFAULT_PGM_TAIL_STARTUP_PWR = 10 ; 1=0.031 2=0.047 3=0.063 4=0.094 5=0.125 6=0.188 7=0.25 8=0.38 9=0.50 10=0.75 11=1.00 12=1.25 13=1.50 .EQU DEFAULT_PGM_MULTI_STARTUP_PWR = 10 ; 1=0.031 2=0.047 3=0.063 4=0.094 5=0.125 6=0.188 7=0.25 8=0.38 9=0.50 10=0.75 11=1.00 12=1.25 13=1.50 ;********************* ; PORT D definitions * ;********************* ;.EQU = 7 ;i ;.EQU = 6 ;i .EQU AnFET = 5 ;o .EQU ApFET = 4 ;o ;.EQU = 3 ;i .EQU Rcp_In = 2 ;i ;.EQU = 1 ;i ;.EQU = 0 ;i .equ INIT_PD = (1<