;**** **** **** **** **** ; ; 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 Atmega8 ;********************* .include "m8def.inc" .equ ICP = 0 ; Choose input pin. Set to 0 for INT0 (pin32) and 1 for ICP1 (pin12) ;**** **** **** **** **** ; Fuses must be set to internal calibrated oscillator = 8Mhz ;**** **** **** **** **** ;**** **** **** **** **** ; Constant definitions ;**** **** **** **** **** .equ ADC_LIMIT_L = 211 ; Power supply measurement ADC value for which main motor power is limited (low byte) .equ ADC_LIMIT_H = 0 ; Power supply measurement ADC value for which main motor power is limited (2 MSBs) ;********************* ; PORT D definitions * ;********************* ;.equ = 7 ;i .equ Comp_Com = 6 ;i Comparator common input (AIN0) .equ ApFET = 5 ;o .equ CpFET = 4 ;o .equ BpFET = 3 ;o .equ Rcp_In = 2 ;i RC pulse input ;.equ = 1 ;i ;.equ = 0 ;i .equ INIT_PD = 0 .equ DIR_PD = (1<