📄 globals_var.h
字号:
/*******************************************************************************
OKM-BLDC-SERVO-MOTOR-10W
作者:Alan, 2008-5-3
最后修改:Alan,2008-5-3
芯片:ATMEGA88,
编译器:avr-gcc (GCC) 4.1.2 (WinAVR 20070525)
版本说明:
V0.1 初版
*******************************************************************************/
/*******************************************************************************
全局变量定义
*******************************************************************************/
#ifndef _GLOBALS_VAR_H_
#define _GLOBALS_VAR_H_
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/eeprom.h>
#include <avr/pgmspace.h>
typedef unsigned char uchar;
typedef unsigned int uint;
typedef unsigned long ulong;
//细分分类数目
#define MaxStepNumb 16
#define ENABLE 1
#define DISABLE 0
#define _DebugEnable_ ENABLE
#if _DebugEnable_
//2400
//#define UART_baud 520
//4800
//#define UART_baud 259
//9600
#define UART_baud 129
//19200
//#define UART_baud 64
#define UARTBufSize 100
typedef struct {
unsigned char vTop;
unsigned char vPoint;
unsigned char vFIFOBuf[UARTBufSize];
}FIFO_BUFF;
#define fUartWREnd 0 //当UART 发送结束时为0
#ifdef _DEBUG_C_H_
FIFO_BUFF vUartWriteBuf;
uchar vStateFlag;
const prog_uchar ASIIC_DATA[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
void UART_Init(void);
void UART_Push_WR_Buf(unsigned char dat);
void UART_putHex(uchar c);
#else
extern FIFO_BUFF vUartWriteBuf;
extern FIFO_BUFF vUartReadBuf;
extern uchar vStateFlag;
extern void UART_Init(void);
extern void UART_Push_WR_Buf(unsigned char dat);
extern void UART_putHex(uchar c);
#define DEBUG_OUT(x) UART_Push_WR_Buf(x)
#define DEBUG_Init() UART_Init()
#define DEBUG_PutHex(x) UART_putHex(x)
#endif
#else
#define DEBUG_OUT(x)
#define DEBUG_Init()
#define DEBUG_PutHex(x)
#endif
#ifdef _MAIN_C_H_
#define VAR_EXT
//数据对应桥臂关系 0=on 1=off
//0b 0 0 0 0 0 0 0 0
// CL BL CH BH AH 0 0 AL
//正向运转输出表
// 4 6 2 3 1 5
//AT 0 1 1 1 1 0
//BT 1 0 0 1 1 1
//CT 1 1 1 0 0 1
//AB 0 0 1 1 0 0
//BB 0 0 0 0 1 1
//CB 1 1 0 0 0 0
const prog_uchar cFwdOutPut[8]={
// CL BL CH BH AH 0 0 AL
0xff, //
0x58, //1 0 1 0 1 1 0 0 0
0x29, //2 0 0 1 0 1 0 0 1
0x19, //3 0 0 0 1 1 0 0 1
0xB0, //4 1 0 1 1 0 0 0 0
0x70, //5 0 1 1 1 0 0 0 0
0xA8, //6 1 0 1 0 1 0 0 0
0xff};
//反向运转输出表
// 4 6 2 3 1 5
//AT 1 1 0 0 1 1
//BT 1 1 1 1 0 0
//CT 0 0 1 1 1 1
//AB 1 0 0 0 0 1
//BB 0 1 1 0 0 0
//CB 0 0 0 1 1 0
const prog_uchar cRevOutPut[8]={
// CL BL CH BH AH 0 0 AL
0xff, //
0xA8, //1 1 0 1 0 1 0 0 0
0x70, //2 0 1 1 1 0 0 0 0
0xB0, //3 1 0 1 1 0 0 0 0
0x19, //4 0 0 0 1 1 0 0 1
0x29, //5 0 0 1 0 1 0 0 1
0x58, //6 0 1 0 1 1 0 0 0
0xff};
#else
#define VAR_EXT extern
extern prog_uchar cFwdOutPut[8];
extern prog_uchar cRevOutPut[8];
#endif
VAR_EXT uchar vMotorFwd; //电机运转方向设定 ==0 正向, != 0 反向
VAR_EXT uchar vMotorStateFlag; //电机状态标志
#define fMotorStart 0 //电机运转标志
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -