📄 pm.c
字号:
/*************************************************************************************
文件类型:底层驱动函数文件
文件作用:
修改权限:底层驱动维护人员
文件相关:
创 建 人:GeminiKQ
创建日期:2006.12.20
当前版本:Ver0.1
版本信息:Ver0.1 GeminiKQ
**************************************************************************************/
#include "ChipDefine.h"
#include "ExTigReg.h"
#define WPADDRESS 0x1094 // 写缓存首地址
#define RLADDRESS 0x1093 // 读缓存末地址
//=======================================================
//函数名:W_Buff
//函数作用:写数据到写缓存
//入口参数:需要写的32位数据
//出口参数:无
//
//=======================================================
void W_Buff(unsigned long lword)
{
unsigned char xdata *point;
point = WPADDRESS;
*(point++) = (unsigned char)lword;
*(point++) = (unsigned char)(lword>>8);
*(point++) = (unsigned char)(lword>>16);
*point = (unsigned char)(lword>>24);
}
//=======================================================
//函数名:W_Byte
//函数作用:写数据到地址
//入口参数:Addr-目标地址,Wdata-操作数据
//出口参数:无
//
//=======================================================
void W_Byte(unsigned int Addr,unsigned char Wdata)
{
unsigned char xdata *point;
point = Addr;
*point = Wdata;
}
//=======================================================
//函数名:R_Byte
//函数作用:从目标地址读数据
//入口参数:目标地址
//出口参数:读出的数据
//
//=======================================================
unsigned char R_Byte(unsigned int Addr)
{
unsigned char xdata *point;
unsigned char Rdata;
point = Addr;
Rdata = *point;
return Rdata;
}
//=======================================================
//函数名:R_Buff
//函数作用:从读缓存读数据
//入口参数:无
//出口参数:读出的32位数据
//
//=======================================================
unsigned long R_Buff(void)
{
unsigned char xdata *point;
unsigned long longword;
point = RLADDRESS;
longword = *(point--);
longword <<= 8;
longword += *(point--);
longword <<= 8;
longword += *(point--);
longword <<= 8;
longword += *(point--);
return longword;
}
void SetPM(void)
{
// write code
PmPwd = 0xcd;
// on_u
W_Byte(0x28a2,0x0f); // 28a2.0
// on_ia
// W_Byte(0x28a2,0x02); // 28a2.1
// on_ib
// W_Byte(0x28a2,0x04); // 28a2.2
// on_m
// W_Byte(0x28a2,0x08); // 28a2.3
// sel_iab_d || sel_plus_d
W_Byte(0x28a3,0x00);
W_Byte(0x28a1,0);
// IA比差校正值
W_Buff(0x0);
// W_Byte(0x107b,0);
// IB
W_Byte(0x1080,0);
// LA
// W_Byte(0x107d,0);
// LB
// W_Byte(0x107e,0);
// W_Buff(0x0800);
// W_Byte(0x1086,0);
// gate
W_Buff(0x56f00000);
W_Byte(0x107b,0);
W_Buff(0x0000001c);
W_Byte(0x107a,0);
// calibration
W_Buff(0xf3459369);
W_Byte(0x1087,0);
// W_Buff(0xe5e341df);
// W_Byte(0x1083);
PmPwd = 0xcc;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -