WINDOWLIFTLIBRARY Documentation
This software package has been developped to run on the ATAVRAUTO200. This board is available as an ATMEL reference design for ATmega48/88/168.
The application board embeddes:
- ATmega88 : MCU
- ATA6620 : LIN tranceiver & Voltage Regulator
- A Relay to control the motor
- A Shunt resistor and an amplifier to Measure Motor current
- A hall sensor interface (5V output + Two interrupt inputs)
- Battery Voltage measurment
- Over-current detection
- LED, Reset button...
Please Refer to AVR480 and AVR191 application notes to go in more details into our Anti-pinch algorithm.
The main source files are :
- main.c
main loop, Handles Initialization process as well as normal operation process. Il also manages ADC acquisitions as well as window lift operations, eeprom storage, and lin buffers at a higher level. - hall_sensor_ISR.c
Hall sensor interrupt subroutine is used to compute Anti-pinch reference current. You'll also find here Timer0 ISR used to schedule ADC acquisitions. - ldf_window_lift.c
Defines LIN v1.3 schedule used in this application. It's also responsible of window-lift parameters downloading from the LIN. - timer1_ovf_isr.c
This overflow interrupt occurs when no more activity is detected on hall sensors (Window-lift stopped). A flag is set to signal parameters have to be stored to eeprom. If not stopped, the motor is stopped. - window_lib.c
This file contain all operation, parameters storage/recover from eeprom, Initialization routines realted to the Anti-pinch.
lin_drv_usart.c
Low level routines to run LIN using AVR USART (ATMega48/88/168 in our case). (Please refer to LIN application notes.)
- lin_lib.c
Mid level routines to run LIN on AVR MCUs. (Please refer to LIN application notes.) - slave_lin.c
High level API to run slave LIN v1.3 on AVR MCUs. (Please refer to LIN application notes.) - eep_lib.c
EEPROM Write and Read routines - filtre1.c
Filtering and average routines (used to average motor current)
This demonstration software allows to run a minimal Anti-pinch algorithm based on AVR implementation. DC motor Position/speed and current are monitored to realize such a functionality.
- Motor can be operated upward and downward.
- After a correct set of parameters have been filled into MCU EEPROM (can be downloaded from LIN network), and after a correct window-lift initialization, our Anti-pinch algorithm is albe to detect pinches and to reverse window-lift direction when a pinch occurs. Refer to AVR480 and AVR191 application notes for more details.
- Timer 0 Schedules ADC acquisition, and so main loop execution.
- Timer 1 is used to measure hall sensor(s) signal periodicity. It's used to measure window-lift speed.
- Pin Change interrupts 10, 11 are used for one or two hall sensors inputs. Corresponding interrupt subroutine allow to compute Current reference used by the algorithm.
- ADC is used for Motor current. Power supply value could also be acquired.
- USART is used by the LIN Library
- EEPROM is used to store parameters, and window-lift position... (see AVR191 for the complete structure)
- Analog comarator could be used to generate overcurrent interrupts, in order to protect Hardware efficiently.
- 8Mhz internal RC Oscillator in being used (65ms startup time)
- No clock prescaler is being used
- Brown-out detector used.
It can be compiled either using IAR EWAVR4.20A or avr-gcc (WinAVR-20060421 with AVR Studio 4.12 Service pack 4, both free of charge).
- To use it under IAR, open the ewp project file. The project should contain the previous described source files. You can compile it and open the compiled files under AVR Studio for MCU programming/debugging.
- To use it under avr-gcc, launch AVR Studio, create a new AVR-GCC project. In project configuration options, select the corresponding MCU (atmega88), add several include directories to the project: Project directory, parent directory, lib_mcu and lib_board. and add the files described above. You can compile it and then make MCU programming/debugging.
- The ATmega88 is supported by AVR Studio, version 4.12 or higher. For up-to-date information on this and other AVR tool products, please consult our web site. The newest version of AVR Studio, AVR tools and user's guide can be found in the AVR section of the Atmel web site, http://www.atmel.com
Generated on Mon May 28 20:26:50 2007 for WINDOWLIFTLIBRARY by
1.4.7