当前位置:网站首页>Kt148a voice chip IC software reference code c language, first-line serial port
Kt148a voice chip IC software reference code c language, first-line serial port
2022-07-02 19:41:00 【Qingyue Electronics】
Catalog
4.2 Communication examples F3-- Group play
4.3 Communication command F0 describe 【 Ultra-low power consumption 】
4.4 Communication details and precautions
First line communication protocol
At present, the chip supports one-line serial communication protocol , It is also determined by the time width of high and low levels 0 perhaps 1 .
3.1 Communication format
Be careful : The high level must be in front , Low level is in the rear .
Recommended 200us:600us. Value range : narrow pulse =[150us--400us] Wide pulse [500us--1000us]
Pay attention to 3:1 and 1:3 Level proportion to ensure stable communication .
Pay attention to the beginning 6ms Low level , During initial commissioning , Try to use an oscilloscope or logic analyzer to see , Error in 10% Both sides can accept
1、0x00H To 0xDFH Define a function code for the voice address code .
2、0xFE Is the voice stop code , Send this command to stop playing voice .
3、 The interval between codes must be greater than 20ms
3.2 Communication command
NO. Serial number | Data code | Voice Speech meter |
0 | 0x00 | Retain |
1 | 0x01 | voice 1 |
2 | 0x02 | voice 2 |
3 | 0x03 | voice 3 |
…… | ||
224 | 0xE0~0xEF | 15 Level volume ,0xE0H Is the minimum volume 0,0xEFH Maximum volume ( Power on default ). ( If you need to adjust the volume , Then send the volume code first , Partition 20ms Send the voice code again ) |
225 | 0xF0 | To turn it off . Enter the ultra-low power consumption state =1.7uA, See 4.3 chapter After entering this state , You also need a control chip , You need to lower it first DATA foot 40ms The purpose is to wake up the chip , You can send commands to control normally , |
242 | 0xF2 | Cyclic code -- See 4.1 chapter If you need to cycle a sound , Then send the voice code first , Partition 20ms Retransmit cyclic code ) |
243 | 0xF3 | Code play -- See 4.2 chapter F3H+ Voice address A, Voice address B, Voice address C,… At the playback address A When , Don't interrupt after receiving the code , End of play A, Just play it B, And then play C….F3 And address 20ms Time delay of . And one group of concatenated addresses and the next group of addresses need 40ms Time delay (“F3+ Voice address ” For a set of concatenated addresses ) |
254 | 0xFE | Stop code |
/*******************************************************************************
- Function description : One line communication data transmission 【 Pay attention to debugging , Use an oscilloscope or logic analyzer to check the pulse width 】
- Subordinate module : Inside
- Parameter description :dat = Data to be sent
- Return instructions : nothing
********************************************************************************/
#define IO1_HIGH() JL_PORTA->DIR &= ~BIT(6);JL_PORTA->OUT |= BIT(6);
#define IO1_LOW() JL_PORTA->DIR &= ~BIT(6);JL_PORTA->OUT &= ~BIT(6);
void oneline_send_one_data(u8 dat)
{
u8 i = 0 ;
IO1_LOW() ;/* Now pull the bus down */
udelay(5000) ;/* Time delay 6MS --- Here is the starting signal for initiating communication */
CPU_SR_ALLOC();// Close the interrupt -- Chips are different , The interfaces may be different
OS_ENTER_CRITICAL();// Close the interrupt
for(i=0 ; i<8 ;i++){
if(dat & 0x01){
IO1_HIGH() ;
udelay(500);/* Time delay 600us*/
IO1_LOW();
udelay(170) ;/* Time delay 200us*/
}else{
IO1_HIGH() ;
udelay(170);/* Time delay 200us*/
IO1_LOW();
udelay(500) ;/* Time delay 600us*/
}
dat = dat >> 1 ;/* At the time of sending , Send the highest bit first , Send the next high bit , And so on */
}
IO1_HIGH() ;/* When you are free, just pull the foot up */
OS_EXIT_CRITICAL();// Open the interrupt
/* At the same time pay attention to , When the chip is initialized , Please pull up the signal pin .*/
}
oneline_send_one_data(0x05);// Corresponding to play the 5 Segment sound
- Communications give an example F2-- Loop Playback
void oneline_test_CMD_F2(void){
oneline_send_one_data(0x01) ;
udelay(20) ;/* Time delay 25ms*/
oneline_send_one_data(0xF2) ;
udelay(20) ;/* Time delay 25ms*/
} To achieve the effect of , It's the first sound , Loop Playback , Don't stop . If you need to stop , Can send FE Instructions
4.2 Communications give an example F3-- Group play
void oneline_test_CMD_F3(void){
oneline_send_one_data(0xF3) ;
udelay(20) ;/* Time delay 25ms*/
oneline_send_one_data(0x01) ;
udelay(20) ;/* Time delay 25ms*/
oneline_send_one_data(0x02) ;
udelay(20) ;/* Time delay 25ms*/
oneline_send_one_data(0x03) ;
udelay(20) ;/* Time delay 25ms*/
} Group play No 1 paragraph 、 The first 2 paragraph 、 The first 3 Segment sound , Play in sequence . If you need to stop , Can send FE Instructions
meanwhile , In the process of combined playing , New combined playback data received , Will stop the current combo playback , Go ahead and play the new command
4.3 Communications Instructions F0 describe 【 Ultra-low power consumption 】
1、 Designed for chip access to ultra low power , Because the chip after the playback , Will automatically enter standby mode , Power consumption is maintained at 25uA .
2、 If the power consumption of the chip is lower , You need to send F0 Instructions , In any state
3、 The chip receives F0 After the instruction , Will enter the shutdown state , Power consumption is maintained at 1.7uA about
4、 If the chip needs to receive instructions again , You must first dat Signal down 40ms, Let the chip wake up , Just send the data
4.4 Communications Detail Notes
1、 control MCU After power on , The first time we need to communicate IO, That is to say ONELINE Pin is set to high level output
2、 Try and KT148A Communication between chips , strand 1K The resistance of , To adapt to different levels
3、 Chip 2 foot PB9, On the air , The voltage is about 3.1V about . Once idle , this IO Will become 2.8V about
Because there is a mechanism for idle to enter low-power standby in the chip .
边栏推荐
- Reading notes of "the way to clean structure" (Part 2)
- Correspondence between pytoch version, CUDA version and graphics card driver version
- Bubble sort array
- xml开发方式下AutowiredAnnotationBeanPostProcessor的注册时机
- How to set priorities in C language? Elaborate on C language priorities
- 《重构:改善既有代码的设计》读书笔记(下)
- Virtual machine initialization script, virtual machine mutual secret key free
- Microservice technology - distributed global ID in high concurrency
- Educational Codeforces Round 129 (Rated for Div. 2) 补题题解
- 守望先锋世界观架构 ——(一款好的游戏是怎么来的)
猜你喜欢
AcWing 342. 道路与航线 题解 (最短路、拓扑排序)
Educational codeforces round 129 (rated for Div. 2) supplementary problem solution
Quanzhi A33 uses mainline u-boot
Introduction to program ape (XII) -- data storage
450-深信服面经1
Zabbix5 client installation and configuration
Istio部署:快速上手微服务,
SQLite 3.39.0 发布,支持右外连接和全外连接
Chic Lang: completely solve the problem of markdown pictures - no need to upload pictures - no need to network - there is no lack of pictures forwarded to others
Istio1.12:安装和快速入门
随机推荐
Windows2008R2 安装 PHP7.4.30 必须 LocalSystem 启动应用程序池 不然500错误 FastCGI 进程意外退出
高并发下如何避免产生重复数据?
Understanding and function of polymorphism
AcWing 181. 回转游戏 题解(搜索—IDA*搜索)
Gamefi chain game system development (NFT chain game development function) NFT chain game system development (gamefi chain game development source code)
Set up sentinel mode. Reids and redis leave the sentinel cluster from the node
《重构:改善既有代码的设计》读书笔记(上)
R language uses econcharts package to create microeconomic or macroeconomic maps, and indifference function to visualize indifference curve
搭建主从模式集群redis
Reading notes of "the way to clean structure" (Part 2)
第七章-类基础
职场四象限法则:时间管理四象限与职场沟通四象限「建议收藏」
450 Shenxin Mianjing 1
LeetCode 0871. Minimum refueling times - similar to poj2431 jungle adventure
Getting started with typescript
Web2.0 giants have deployed VC, and tiger Dao VC may become a shortcut to Web3
SIFT feature point extraction "suggestions collection"
冒泡排序数组
Data dimensionality reduction principal component analysis
[pytorch learning notes] tensor