freescale

来自「Freescale 系列单片机常用模块与综合系统设计」· 代码 · 共 92 行

TXT
92
字号
#ifndef __GLOB_VAR_H__
#define __GLOB_VAR_H__

/******************************************************************
 * These variables are allocated from address 0x88 to 0xAC. During
 * flash management these variables are backe up in BACKUP_FLASH
 * area.
 */

/* Display related variables */
EXT Byte display_en;         // Used for the multiplexing of the displays.
EXT Byte arr_display_index;  // Inidicates which display is selected
EXT Byte arr_display[6];     // Array containing the data that is to
                             //    be shown in the diplayes.   

/* Push button related variables */
EXT Byte read_buttons_time;  // To read the buttons every 30 ms.
EXT Byte pushed_buttons;     // Byte indicating which buttons are pressed.

/* State-machine related variables */
EXT Byte current_state;     // To select a state in the state machine.

/* Variables used in state FARES */
EXT Byte fare_type;          // Indicates which fare is being selected.
EXT Word fare_active;        // Indicates which fare is active.
EXT Word ini_ch_active;      // Indicates which initial charge is active.

/* Variables used for timing and counting*/
EXT Word counter_ms;         // General purpose counter; Incremented every 
                             //    timer overflow: - 1ms
EXT Word counter_pulses;     // General purpose counter; Incremented every 
                             //    IRQ - wheel turn.
EXT Byte clock_hours;        // Incremented every hour
EXT Byte clock_minutes;      // Incremented every minute
EXT Word clock_ms;           // Incremented every ms.

/* Variables used for accumulating while in service */
EXT Word accumulator_pulses; // Number of pulses since last increment.
EXT Word accumulator_time;   // Number of ms since last increment.
EXT Word accumulator_extras; // Accumulator of all extra charges applied.

/* Variables used for charging */
EXT Word inc_time;           // Time for an increment in accumulator_trip.
EXT Word inc_distance;       // Distance for an increment in accumulator_trip.

/******************************************************************
 * These variables are allocated from address 0x80 to 0x87 and from
 * 0xAD to 0xAF. These variables must not overlap with any other 
 * global variable. If global variables are added, you must verify
 * (using the .map file) that these variables do not overlap with any
 * others. It is also important to keep these variables in the
 * location they are placed, because they are read <BackupAccumulators>
 * when flash memory is being manipulated. Manipulation of flash 
 * memory requires to use RAM area from 0x88 to 0xAC, so these variables
 * must be outside that area.
 */
 
EXT ulong accumulator_distance_traveled @ 0x80;  // Distance traveled since 
                                                 //    last time it was 
                                                 //    backed up in flash
EXT ulong accumulator_trip              @ 0x84;  // Accumulator of the trip 
                                                 //    income.
EXT Word  accumulator_inc               @ 0xAD;  // Number of increments
                                                 //    in accumulator_trip
EXT Byte flag_charge                    @ 0xAF;  // Indicates wheather the 
                                                 //    trip is being charged 
                                                 //    or not. 1 = Charging.
                                                 //    0 = No Charging.

/******************************************************************
 * Variables only used when reprogramming accumulators. 
 * These variables overlap with some of the previosly defined
 * variables. However, these variables are used only in specific
 * places <BackupAccumulators()> and overlapping variables are
 * backed up before they are overwritten and they are restored
 * later. The position of these variables matches the position
 * of variables: TOTAL_DISTANCE_TRAVELED, TOTAL_DISTANCE_IN_SERVICE,
 * TOTAL_NUMBER_TRAVELS, TOTAL_NUMBER_INCREMENTS, and TOTAL_INCOME
 * (The previos variables are stored starting at 0xEC81 = page
 * addres 0xEC80 + offset 0x0001. When they are read into RAM, they
 * are placed starting at address 0x008C. Therefore 0x008D has 
 * an offset of 0x0001). 
 */             
 
EXT ulong total_distance_traveled    @ 0x8D;
EXT ulong total_distance_in_service  @ 0x91;
EXT ulong total_number_travels       @ 0x95;
EXT ulong total_number_increments    @ 0x99;
EXT ulong total_income               @ 0x9D; 

#endif  // __GLOB_VAR_H__

⌨️ 快捷键说明

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