📄 ad3.h
字号:
/** ###################################################################
** THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
** Filename : AD3.H
** Project : che_free
** Processor : MC9S12DG128BCPV
** Beantype : ADC
** Version : Bean 01.354, Driver 01.09, CPU db: 2.87.280
** Compiler : Metrowerks HC12 C Compiler
** Date/Time : 2008-3-16, 上午 09:57
** Abstract :
** This device "ADC" implements an A/D converter,
** its control methods and interrupt/event handling procedure.
** Settings :
** AD control register : ATD1CTL2 [290]
** AD control register : ATD1CTL3 [291]
** AD control register : ATD1CTL4 [292]
** AD control register : ATD1CTL5 [293]
** AD control register : ATD1STAT0 [294]
** AD control register : ATD1STAT1 [299]
** AD control register : ATD1CTL23 [290]
** AD control register : ATD1CTL45 [292]
** AD control register : ATD1TEST1 [297]
** AD control register : ATD1DIEN [301]
** AD result register : ATD1DR0 [304]
** Interrupt name : Vatd1
** Interrupt enable reg. : ATD1CTL2 [290]
** Priority : 0
** User handling procedure : AD3_OnEnd
** Number of conversions : 1
** AD resolution : 8-bit
**
** Input pins
**
** Port name : AD1
** Bit number (in port) : 0
** Bit mask of the port : 1
** Port data register : PORTAD1 [303]
**
** Initialization:
** Conversion : Enabled
** Event : Enabled
** High speed mode
** Prescaler : divide-by-30
** Contents :
** Enable - byte AD3_Enable(void);
** Disable - byte AD3_Disable(void);
** Start - byte AD3_Start(void);
** Stop - byte AD3_Stop(void);
** Measure - byte AD3_Measure(bool WaitForResult);
** GetValue8 - byte AD3_GetValue8(byte *Values);
** GetChanValue8 - byte AD3_GetChanValue8(byte Channel,byte *Value);
**
** (c) Copyright UNIS, spol. s r.o. 1997-2005
** UNIS, spol. s r.o.
** Jundrovska 33
** 624 00 Brno
** Czech Republic
** http : www.processorexpert.com
** mail : info@processorexpert.com
** ###################################################################*/
#ifndef __AD3
#define __AD3
/* MODULE AD3. */
/*Include shared modules, which are used for whole project*/
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
#include "PE_Timer.h"
#include "Cpu.h"
#pragma DATA_SEG AD3_DATA
#pragma CODE_SEG AD3_CODE
#define AD3_EnableTrigger AD3_EnableExtChanTrigger
/*
** ===================================================================
** The EnableTrigger method has been renamed to
** the EnableExtChanTrigger.
** This macro is here to keep project backward compatibility.
** ===================================================================
*/
#define AD3_DisableTrigger AD3_Stop
/*
** ===================================================================
** Now, the Stop method is used for disabling the trigger mode
** instead of the DisableTrigger.
** This macro is here to keep project backward compatibility.
** ===================================================================
*/
#pragma CODE_SEG __NEAR_SEG NON_BANKED
__interrupt void AD3_Interrupt(void);
#pragma CODE_SEG AD3_CODE
/*
** ===================================================================
** Method : AD3_Interrupt (bean ADC)
**
** Description :
** The method services the interrupt of the selected peripheral(s)
** and eventually invokes of the bean event(s).
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
byte AD3_Enable(void);
/*
** ===================================================================
** Method : AD3_Enable (bean ADC)
**
** Description :
** Enables A/D converter bean. <Events> may be generated
** (<DisableEvent>/<EnableEvent>). If possible, this method
** switches on A/D converter device, voltage reference, etc.
** Parameters : None
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ===================================================================
*/
byte AD3_Disable(void);
/*
** ===================================================================
** Method : AD3_Disable (bean ADC)
**
** Description :
** Disables A/D converter bean. No <events> will be
** generated. If possible, this method switches off A/D
** converter device, voltage reference, etc.
** Parameters : None
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ===================================================================
*/
byte AD3_Start(void);
/*
** ===================================================================
** Method : AD3_Start (bean ADC)
**
** Description :
** This method starts continuous conversion on all channels
** that are set in the bean inspector. When each measurement
** on all channels has finished the <OnEnd > event may be
** invoked. This method is not available if the <interrupt
** service> is disabled and the device doesn't support the
** continuous mode. Note: If time of measurement is too
** short and the instruction clock is too slow then the
** conversion complete interrupt and its handler may cause a
** system overflow.
** Parameters : None
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ERR_DISABLED - Device is disabled
** ERR_BUSY - A conversion is already
** running
** ===================================================================
*/
byte AD3_Stop(void);
/*
** ===================================================================
** Method : AD3_Stop (bean ADC)
**
** Description :
** This method stops the continuous measurement, which had
** been started by <Start> method, or this method disables a
** trigger mode which has been enabled by <EnableInt(Chan)
** Trigger> or <EnableExt(Chan)Trigger> method (if these are
** supported by HW). This method is available if at least
** one of <Start>, <EnableInt(Chan)Trigger> or
** <EnableExt(Chan)Trigger> methods is supported by A/D
** converter device and it is enabled to be generated.
** Parameters : None
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ERR_BUSY - No continuous measurement is
** running. Neither internal trigger nor
** external trigger have been enabled (if
** these are supported by HW).
** ===================================================================
*/
byte AD3_Measure(bool WaitForResult);
/*
** ===================================================================
** Method : AD3_Measure (bean ADC)
**
** Description :
** This method performs one measurement on all channels that
** are set in the bean inspector. (Note: If the <number of
** conversions> is more than one the conversion of A/D
** channels is performed specified number of times.)
** Parameters :
** NAME - DESCRIPTION
** WaitForResult - Wait for a result
** of a conversion. If <interrupt service>
** is disabled, A/D peripheral doesn't
** support measuring all channels at once
** or <Autoscan mode> property isn't
** enabled and at the same time the <number
** of channel> is greater than 1, then the
** WaitForResult parameter is ignored and
** the method waits for each result every
** time. If the <interrupt service> is
** disabled and a <number of conversions>
** is greater than 1, the parameter is
** ignored and the method also waits for
** each result every time.
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ERR_DISABLED - Device is disabled
** ERR_BUSY - A conversion is already
** running
** ===================================================================
*/
byte AD3_GetValue8(byte *Values);
/*
** ===================================================================
** Method : AD3_GetValue8 (bean ADC)
**
** Description :
** This method returns the last measured values of all
** channels justified to the left. Compared with <GetValue>
** method this method returns more accurate result if the
** <number of conversions> is greater than 1 and <AD
** resolution> is less than 8 bits. In addition, the user
** code dependency on <AD resolution> is eliminated.
** Parameters :
** NAME - DESCRIPTION
** * Values - Pointer to the array that
** contains the measured data.
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ERR_NOTAVAIL - Requested value not
** available
** ERR_OVERRUN - External trigger overrun
** flag was detected after the last value(s)
** was obtained (for example by GetValue).
** This error may not be supported on some
** CPUs (see generated code).
** ===================================================================
*/
byte AD3_GetChanValue8(byte Channel,byte *Value);
/*
** ===================================================================
** Method : AD3_GetChanValue8 (bean ADC)
**
** Description :
** This method returns the last measured value of required
** channel justified to the left. Compared with
** <GetChanValue> method this method returns more accurate
** result if the <number of conversions> is greater than 1
** and <AD resolution> is less than 8 bits. In addition, the
** user code dependency on <AD resolution> is eliminated.
** Parameters :
** NAME - DESCRIPTION
** Channel - Channel number. If only one
** channel in the bean is set then this
** parameter is ignored.
** * Value - Pointer to the measured value.
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ERR_NOTAVAIL - Requested value not
** available
** ERR_RANGE - Parameter "Channel" out of
** range
** ERR_OVERRUN - External trigger overrun
** flag was detected after the last value(s)
** was obtained (for example by GetValue).
** This error may not be supported on some
** CPUs (see generated code).
** ===================================================================
*/
void AD3_Init(void);
/*
** ===================================================================
** Method : AD3_Init (bean ADC)
**
** Description :
** Initializes the associated peripheral(s) and the bean's
** internal variables. The method is called automatically as a
** part of the application initialization code.
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
#pragma CODE_SEG DEFAULT
/* END AD3. */
#endif /* ifndef __AD3 */
/*
** ###################################################################
**
** This file was created by UNIS Processor Expert 2.96 [03.76]
** for the Freescale HCS12 series of microcontrollers.
**
** ###################################################################
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -