📄 fc430_es417.h
字号:
//*****************************************************************************
// Copyright (C) 2005 Texas Instruments, Inc.
//
// File: fc430_es417.h
//
// System Controller data types for MSP430 Fan Controller development board
//
// Author: Randy Wu
// Company: Texas Instruments, Inc
// Date: November 2005
//
// THIS PROGRAM IS PROVIDED "AS IS". TI MAKES NO WARRANTIES OR
// REPRESENTATIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
// INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR
// COMPLETENESS OF RESPONSES, RESULTS AND LACK OF NEGLIGENCE.
// TI DISCLAIMS ANY WARRANTY OF TITLE, QUIET ENJOYMENT, QUIET
// POSSESSION, AND NON-INFRINGEMENT OF ANY THIRD PARTY
// INTELLECTUAL PROPERTY RIGHTS WITH REGARD TO THE PROGRAM OR
// YOUR USE OF THE PROGRAM.
//
// IN NO EVENT SHALL TI BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
// CONSEQUENTIAL OR INDIRECT DAMAGES, HOWEVER CAUSED, ON ANY
// THEORY OF LIABILITY AND WHETHER OR NOT TI HAS BEEN ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGES, ARISING IN ANY WAY OUT
// OF THIS AGREEMENT, THE PROGRAM, OR YOUR USE OF THE PROGRAM.
// EXCLUDED DAMAGES INCLUDE, BUT ARE NOT LIMITED TO, COST OF
// REMOVAL OR REINSTALLATION, COMPUTER TIME, LABOR COSTS, LOSS
// OF GOODWILL, LOSS OF PROFITS, LOSS OF SAVINGS, OR LOSS OF
// USE OR INTERRUPTION OF BUSINESS. IN NO EVENT WILL TI'S
// AGGREGATE LIABILITY UNDER THIS AGREEMENT OR ARISING OUT OF
// YOUR USE OF THE PROGRAM EXCEED FIVE HUNDRED DOLLARS
// (U.S.$500).
//
// Unless otherwise stated, the Program written and copyrighted
// by Texas Instruments is distributed as "freeware". You may,
// only under TI's copyright in the Program, use and modify the
// Program without any charge or restriction. You may
// distribute to third parties, provided that you transfer a
// copy of this license to the third party and the third party
// agrees to these terms by its first use of the Program. You
// must reproduce the copyright notice and any other legend of
// ownership on each copy or partial copy, of the Program.
//
// You acknowledge and agree that the Program contains
// copyrighted material, trade secrets and other TI proprietary
// information and is protected by copyright laws,
// international copyright treaties, and trade secret laws, as
// well as other intellectual property laws. To protect TI's
// rights in the Program, you agree not to decompile, reverse
// engineer, disassemble or otherwise translate any object code
// versions of the Program to a human-readable form. You agree
// that in no event will you alter, remove or destroy any
// copyright notice included in the Program. TI reserves all
// rights not specifically granted under this license. Except
// as specifically provided herein, nothing in this agreement
// shall be construed as conferring by implication, estoppel,
// or otherwise, upon you, any license or other right under any
// TI patents, copyrights or trade secrets.
//
// You may not use the Program in non-TI devices.
//****************************************************************************/
#ifndef __FC430_ES417
#define __FC430_ES417
/************ CONSTANTS ******************************************************/
// LCD segment definitions
#define h 0x80
#define e 0x40 // AAAA
#define g 0x20 // F B
#define f 0x10 // F B
#define d 0x08 // GGGG
#define c 0x04 // E C
#define b 0x02 // E C
#define a 0x01 // DDDD
// ES417-to-SBLCDA4: LCD segment memory map
// LCDM1: 1F 1G 1E DP1 1A 1B 1C 1D
// LCDM2: 2F 2G 2E DP2 2A 2B 2C 2D
// LCDM3: 3F 3G 3E COL3 3A 3B 3C 3D
// LCDM4: 4F 4G 4E DP4 4A 4B 4C 4D
// LCDM5: 5F 5G 5E COL5 5A 5B 5C 5D
// LCDM6: 6F 6G 6E DP6 6A 6B 6C 6D
// LCDM7: 7F 7G 7E DP7 7A 7B 7C 7D
// LCDM8: F1 F2 F3 F4 F5 PR P4 P3
// LCDM9: AU AR AD AL PL P0 P1 P2
// LCDM10: BT B1 B0 BB ANT A2 A1 A0
// LCDM11: DOLL ERR MINUS MEM ENV TX RX 8BC
#define PERIOD050USEC 52 // assuming ~1.048576 MHz DCO clock
#define TEMP_TIME 2 // measures temp every 5 seconds
#define L0DUTYCYCLE 0 // L0 PWM duty cycle (fan off)
#define L1DUTYCYCLE 30 // L1 PWM duty cycle
#define L2DUTYCYCLE 45 // L2 PWM duty cycle
#define L3DUTYCYCLE 60 // L3 PWM duty cycle
#define L4DUTYCYCLE 80 // L4 PWM duty cycle
#define L5DUTYCYCLE 100 // L5 PWM duty cycle (fan full speed)
#define CALFACTORDEGC 0 // temp. sensor calibration factor (deg C)
#define CALFACTORDEGF -3 // temp. sensor calibration factor (deg F)
#define L0 - NEGRANGE // 0th temp boundary (deg C)
#define L1toL2 70 // 1st temp boundary (deg F)
#define L2toL3 (L1toL2+ LEVELDEGWIDTH) // 2nd temp boundary (deg F)
#define L3toL4 (L2toL3+ LEVELDEGWIDTH) // 3rd temp boundary (deg F)
#define L4toL5 (L3toL4+ LEVELDEGWIDTH) // 4th temp boundary (deg F)
#define L5 (L3toL4+ LEVELDEGWIDTH) // 5th temp boundary (deg F)
#define LEVELDEGWIDTH 7 // # of degrees C per level change
#define MAXVDC 4095 // Maximum possible TEMP result (12 bits => 0xFFF)
#define POSRANGE 99 // Max *possible* temperature boundary reading in deg C (pos)
#define NEGRANGE 50 // Min *possible* temperature boundary reading in deg C (neg)
#define OUTOFRANGE 0x0000FFFF // Signifies that temperature reading is out of range (invalid)
#define HIGHTEMPDEGC L4 // Max *acceptable* temperature boundary reading in deg C
#define LOWTEMPDEGC L0 // Min *acceptable* temperature boundary reading in deg C
#define SLOPEADrREF 10000 // Reference resistor value for Slope A/D (ohms)
#define PERIOD5MSEC 5243 // 5 msec worth of SMCLK tics @ DCO = 1.048576 MHz
enum { ENGLISH, METRIC };
typedef enum Boolean {
TRUE, FALSE
} Boolean;
typedef enum Direction {
UP, DOWN
} Direction;
typedef enum Status {
ALARM, OK
} Status;
typedef enum FanLevel {
FANSLEVEL0, FANSLEVEL1, FANSLEVEL2, FANSLEVEL3, FANSLEVEL4, FANSLEVEL5
} FanLevel;
// Port1 Pin Configuration
#define ACTIVITY BIT0
#define THERM BIT4
#define REF BIT5
#define CA_IN BIT6
// Port2 Pin Configuration
#define TACH BIT0
#define PWM BIT1
#define MAXLEVELSETTINGS 6
#define PULSESPERREVOLUTION 2 // # of frequency generator pulses per 1 revolution of the fan
/************ FUNCTION PROTOTYPES ******************************************************/
void TEMP_init(void);
// Usage: One-time initialization routine to set up the TEMP Slope A/D subsystem
// Parameters: none
signed int cnvtTempDegC(
long int rSENSE);
// Usage: Converts the Slope A/D rSENSE value into actual temperature
// Parameters: Calculated thermistor resistance
// Return value: Temperature in degrees C
void sampleTemp(void);
// Usage: Samples current thermistor temperature
// Parameters: none
void PWM_init(void);
// Usage: One-time FC430_PWM initialization routine
// Parameters: none
void changeLevelAndSpeed(FanLevel systemLevel);
// Usage: Store the new level and update CCR value to change PWM cuty cycle
// Parameters: the level to change to
void setFanSpeed(void);
// Usage: Set PWM output to the duty cycle according to the current system level setting
// Parameters: none
void LCD_init(void);
// Usage: One-time FC430_LCD initialization routine
// Parameters: none
void clearLCD(void);
// Usage: Completely clears the LCD screen
// Parameters: none
void toggleAntenna(void);
// Usage: Toggles the Antenna segment on the LCD
// Parameters: none
void displayValue(int value, int start);
// Usage: Displays the hexadecimal number; least significant digit will show up at the position designated by 'start'
// Parameters: Whole number to display and digit position for 'LSD' to start at
void displayTemp(void);
// Usage: Displays the temperature on the LCD screen
// Parameters: none
void displayTach(int rpm);
// Usage: Displays the tachometer on the LCD screen
// Parameters: Tachometer value in RPM
void displayAllAccessories(void);
// Usage: Displays every accessory possible on the LCD screen
// Parameters: none
void displayLevel( FanLevel level);
// Usage: Displays the specified system level setting on the LCD screen
// Parameters: none
void rotateAccessories(void);
// Usage: Displays and cycles through every accessory possible on the LCD screen
// Parameters: none
void displayUpArrow(void);
// Usage: Displays the 'UP' arrow (and clears the other 3)
// Parameters: none
void displayDownArrow(void);
// Usage: Displays the 'DOWN' arrow (and clears the other 3)
// Parameters: none
void rotateArrows(void);
// Usage: Rotates through all of the arrow accessories on the LCD screen (clockwise direction)
// Parameters: none
void SYS_init(void);
// Usage: One-time FC430_SYS initialization routine
// Parameters: none
void setStatusLED( Status status);
// Usage: Sets the system status LED for Alarm or OK condition
// Parameters: Alarm = LED ON; OK = LED OFF
void updateTach(void);
// Usage: Translate tachometer pulse counts into the actual RPM value
// Parameters: none
void refreshTach(void);
// Usage: Updates all variables corresponding to the tachometer plus LCD operations
// Parameters: none
__interrupt void isrWDT(void);
// Usage: Called on each WatchDog Timer interrupt
// Parameters: none
__interrupt void isrPORT2(void);
// Usage: Called on each Port 2 interrupt
// Parameters: none
__interrupt void isrBT(void);
// Usage: Called on each Basic Timer interrupt
// Parameters: none
__interrupt void isrTIMER0_A1(void);
// Usage: Called whenever TEMP conversion is complete and TEMP INT's are enabled
// Parameters: none
#endif /* __FC430_ES417 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -