;**** **** **** **** **** ; ; BLHeli program for controlling brushless motors in helicopters ; ; 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 . ; ;**** **** **** **** **** ;********************* ; Device Atmega88P(A) ;********************* .include "m88Pdef.inc" .equ ICP = 1 ; Choose input pin. Set to 0 for INT0 (pin32) and 1 for ICP1 (pin12) ;**** **** **** **** **** ; Fuses must be set to external oscillator 8.0- MHz ;**** **** **** **** **** ;**** **** **** **** **** ; Constant definitions ;**** **** **** **** **** .equ ADC_LIMIT_L = 180 ; Power supply measurement ADC value for which main motor power is limited (low byte) .equ ADC_LIMIT_H = 1 ; Power supply measurement ADC value for which main motor power is limited (2 MSBs) ;********************* ; PORT D definitions * ;********************* .equ Mux_B = 7 ;i Phase B input .equ Comp_Com = 6 ;i Comparator common input (AIN0) .equ BnFET = 5 ;o .equ BpFET = 4 ;o .equ CpFET = 3 ;o .equ Rcp_In = 2 ;i RC pulse input .equ ApFET = 1 ;o ;.equ = 0 ;i .equ INIT_PD = 0 .equ DIR_PD = (1<