⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hall_sensors.c

📁 基于Atmel ATMega88+ATA682的应用实例 主要功能包括: 1) PWM输出控制 2) H-Bridge,4 POWER FET 驱动 3) 模拟量比较
💻 C
字号:
/*
**
****************************************************************************
**
**
**             Copyright (c) 2007 - Atmel Corporation
**             Proprietaty Information
**
** Project    	: ATMEGA88 + ATA6824 High Temperature H-bridge System
** Module     	: Hall_sensors.c
** Description	: High temperature DC motor control.
**                To be used with "High temperature H-bridge System" board
**
** Version :     Date:         Author:      Comment:
**    1.0        05.03.2007    F.G.          Creation 
**
** LICENSE -
**
** ATMEL - 2007
** All software programs are provided 'as is' without warranty of any kind:
** Atmel does not state the suitability of the provided materials for any
** purpose. Atmel hereby disclaim all warranties and conditions with regard
** to the provided software, including all implied warranties, fitness for
** a particular purpose, title and non-infringement.In no event will Atmel
** be liable for any indirect or consequential damages or any damages
** whatsoever resulting from the usage of the software program.
****************************************************************************
**
*/


/*_____ I N C L U D E S ____________________________________________________*/
#include "config.h"
#include "Hall_sensors.h"

/*_____ M A C R O S ________________________________________________________*/
/*_____ D E F I N I T I O N S ______________________________________________*/
/*_____ P R O T O T Y P E S - D E C L A R A T I O N ________________________*/
/*_____ G L O B A L S ______________________________________________________*/




/*! @brief Hall_sensors_ISR_init set-up Pin change interrupts on optionnal hall
 *  sensors inputs
 *  - Enable PCINT7 to PCINT0 mask
 *  - Configure Hall 1, and Hall 2 resp. PCINT7 and PCINT6
 *  to generate interrupts on both rising or falling edges.
 */ 
void Hall_sensors_ISR_init(void)
{
    /*init PCINT0  Pin change interrupt initialisation */
    // PCINT7...0 interrupt pins enabled
  PCICR |= 1 << PCIE0;   
    // PCINT7/6 interrupt pin are enabled    
  PCMSK0 |= (1 << PCINT7) | (1 << PCINT6);  
}



/*! @brief hall_sensor_1_2_ISR() handles Hall 1 and 2 pin change interrupts.
 *  This interrupt subroutine allow to generate interrupts on optionnal hall 
 *  sensors inputs
 */
#if defined(__ICCAVR__)       //IAR COMPILER USED
#pragma vector= PCINT0_vect   //Pin Change interrupt 0 vector for ATmega88
__interrupt void hall_sensor_1_2_ISR (void)
#elif defined (__AVR__)       // Avr-gcc compiler used
ISR(PCINT0_vect)
#endif
{
  /*  PLACE NECESSARY CODE HERE 
   *  IF OPTIONNAL HALL SENSOR(S) 
   *  ARE AVAILABLE 
   *  to compute position/speed 
   *  for example.
   */
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -