当前位置:网站首页>Cs5463 code module analysis (including download link)
Cs5463 code module analysis (including download link)
2022-06-28 23:02:00 【Night Star 2022】
CS5463 Single phase bi-directional power IC
char CS5463_Init_LZH(void)
{
// newly added
CS = 1;
delay_us(100); // Time delay
CS = 0;
RST = 0;
// uDelay(100);
delay_us(100); // Time delay
RST = 1;
RST = 0;
delay_us(100);
RST = 1;
//----------------------
// Send synchronization sequence
RX_Buff[0] = CMD_SYNC1;
RX_Buff[1] = CMD_SYNC1;
RX_Buff[2] = CMD_SYNC0;
SEGGER_RTT_printf(0, " Serial initialization \n"); // Debug the general
CS5463WriteReg(CMD_SYNC1, RX_Buff); //#define CMD_SYNC1 0XFF // Start serial port reinitialization
RX_Buff[0] = 0x80;
RX_Buff[1] = 0x00;
RX_Buff[2] = 0x00;
CS5463WriteReg(REG_STATUSR, RX_Buff); // initialization -- Status register #define REG_STATUSR 0x5E // state
//----------------------
// initialization -- Configuration register
// The phase compensation is PC[6:0]=[0000000];
// The current channel gain is Igain=10;
//EWA=0;
//INT The interrupt is active at low level IMODE:IINV=[00]
//iCPU=0
//K[3:0]=[0001]
//
//MCLK=4.096MHz If it is required to calculate every second 10 Time ,N=400, The formula Times=(MCLK/K)/(1024*N).// Calculate per second 1 Time ,N=4000
RX_Buff[0] = 0x00;
RX_Buff[1] = 0x00;
RX_Buff[2] = 0x01;//RX_Buff[2] = 0x01;
CS5463WriteReg(REG_CONFR, RX_Buff); // #define REG_CONFR 0x40 // To configure
// Try to modify N value
// Now use N = 800
// RX_Buff[0] = 0x00;
// RX_Buff[1] = 0x03; //0x0F;
// RX_Buff[2] = 0x20; //0xA0; //#define REG_CYCCONT 0x4A // Of a calculation cycle A/D Conversion number
// CS5463WriteReg(REG_CYCCONT,RX_Buff); // initialization --CYCLE COUNT register ,4000
// RX_Buff[0] = 0x00;
// RX_Buff[1] = 0x0F;
// RX_Buff[2] = 0xA0; //#define REG_CYCCONT 0x4A // Of a calculation cycle A/D Conversion number
// CS5463WriteReg(REG_CYCCONT,RX_Buff); // initialization --CYCLE COUNT register ,4000
//10S
// RX_Buff[0] = 0x00;
// RX_Buff[1] = 0x01;
// RX_Buff[2] = 0x90; //#define REG_CYCCONT 0x4A // Of a calculation cycle A/D Conversion number
// CS5463WriteReg(REG_CYCCONT,RX_Buff); // initialization --CYCLE COUNT register ,400
RX_Buff[0] = 0x00;
RX_Buff[1] = 0x9C;
RX_Buff[2] = 0x40; //#define REG_CYCCONT 0x4A // Of a calculation cycle A/D Conversion number
CS5463WriteReg(REG_CYCCONT, RX_Buff); // initialization --CYCLE COUNT register ,40000
RX_Buff[0] = 0x00;
RX_Buff[1] = 0x00;
RX_Buff[2] = 0x00;
CS5463WriteReg(REG_MASKR, RX_Buff); // initialization -- Interrupt mask register #define REG_MASKR 0x74 // Interrupt mask
//----------------------
// initialization -- Operation register
RX_Buff[0] = 0x00;
RX_Buff[1] = 0x00;
RX_Buff[2] = 0x01;
CS5463WriteReg(REG_MODER, RX_Buff); //#define REG_MODER 0x64 // Operation mode
//----------------------
// initialization -- electric current AC Offset Calibration register
// RW24XX(RX_Buff,3,EE_IACBIAS,0xA1);
// CS5463WriteReg(REG_IACOFF,RX_Buff);
//----------------------
// initialization -- electric current Gain calibration register
// RW24XX(RX_Buff,3,EE_IACGAIN,0xA1);
// CS5463WriteReg(REG_IGN,RX_Buff);
//----------------------
// initialization -- voltage AC Offset Calibration register
// RW24XX(RX_Buff,3,EE_VACBIAS,0xA1);
// CS5463WriteReg(REG_VACOFF,RX_Buff);
//----------------------
// initialization -- voltage Gain calibration register
// RW24XX(RX_Buff,3,EE_VACGAIN,0xA1);
// CS5463WriteReg(REG_VGN,RX_Buff);
//----------------------
//----------------------
// initialization -- Pulse rate register
// RX_Buff[0] = 0x00;
// RX_Buff[1] = 0x34;
// RX_Buff[2] = 0x9C;
// CS5463WriteReg(REG_PULRATE,RX_Buff);
//----------------------
//----------------------
//----------------------
// RX_Buff[0] = 0x00;
// RX_Buff[1] = 0x00;
// RX_Buff[2] = 0x00;
// CS5463WriteReg(REG_CTRLR,RX_Buff); // initialization -- Control register #define REG_CTRLR 0x78 // control
//----------------------
CS5463CMD(CMD_STARTC); // Start continuous conversion #define CMD_STARTC 0XE8 // Perform a continuous calculation cycle
//CS5463_Status = 0; // Initialize task process status
//Load_Status = 0;
//CS5463_CrmsSmallCunt = 0;
//CS5463_CrmsOverCunt = 0;
// SEGGER_RTT_printf(0,"CS5463_Init success! \r\n");
return(1); // Once you have completed these steps, you will return to true 1
}


Code and material Links :https://download.csdn.net/download/weixin_37787043/17198637
边栏推荐
- WEB API学习笔记1
- How powerful is the Zadig build? Practice together
- Leetcode detailed explanation of stack type
- Redis+AOP+自定义注解实现限流
- Tanghongbin, Yaya live CTO: to truly localize, the product should not have the attribute of "origin"
- Interpretation of papers (DCN) towards k-means-friendly spaces: simultaneous deep learning and clustering
- Undefined symbol main (referred from entry9a.o).
- On the necessity and solution of building a campus online teaching video convergence platform
- After crossing, she said that the multiverse really exists
- flowable 边界定时器
猜你喜欢

Qtcreater5.15.0 source code compilation process record

One card can sell tens of millions, and the business expansion is faster than that of players: you don't understand the Jianghu of star cards

Fanuc robot_ Introduction to Karel programming (2)_ Usage of general IO signal

在QT进行cin(全网最清晰教程)

A password error occurred when docker downloaded the MySQL image to create a database link

How powerful is the Zadig build? Practice together

Powerful open source API interface visual management platform Yapi

Wave picking of WMS warehouse management system module

台式机没声音怎么样才能解决

Master the usage of const
随机推荐
如何使用伦敦金画出支撑阻力线
Is it safe and reliable for changtou school to help open a securities account? How to drive
复杂嵌套的对象池(4)——管理多类实例和多阶段实例的对象池
生产环境sonarqube安装
【Word 教程系列第 2 篇】Word 中如何设置每页的表格都有表头
微搭低代码中实现二维码生成
[gateway development] handle the IP address segment represented by CIDR when NGX nested Lua
With a monthly salary of 60000 yuan, such people began to be robbed after the Internet "reduced costs and increased efficiency"
Web API learning notes 1
CPU、GPU、TPU、NPU区别
Basic knowledge diagram of K-line Diagram -- meaning of single K-line
运维排查-使用hcache插件排查Buffer/cache占用过高
Powerful open source API interface visual management platform Yapi
Summary of time series prediction series (code usage)
A password error occurred when docker downloaded the MySQL image to create a database link
In the era of industrial Internet, the Internet in the traditional sense will evolve into many new forms
[sword finger offer] 50 First character that appears only once
计数排序和排序的稳定性
Interpretation of papers (DCN) towards k-means-friendly spaces: simultaneous deep learning and clustering
一张能卖上千万,商家扩张比玩家还快:球星卡的江湖你不懂