*/ ***** POCSAG code error detection and correction ***** /*
*/ Operation result: Flag_Bits.VER_ER=0, the reception is correct or the error code has been corrected;
Flag_Bits.VER_ER=1, the reception is wrong and cannot be corrected;
Completely received codeword: Code_Reg/*
unsigned long Code_Reg; */Code_Reg: stores the recently received POCSAG codeword; /*
*/ Error pattern array for error correction/*
const unsigned int Err_s[]={0x3B4,0x1DA,0xED,0x3C2,0x1E1,0x344,0x1A2,0xD1,0x3DC,0x1EE,0xF7,
0x3CF,0x253,0x29D,0x2FA,0x17D,0x30A,0x185,0x376,0x1BB,0x369,0x200,
0x100,0x80,0x40,0x20,0x10,0x8,0x4,0x2,0x1};
struct Bits
{
POCSAG:1; */The value of the current bit of the received POCSAG code/*
VER_ER:1; */Error flag*/
}Flag_Bits;
void Rcv_POCSAG_Code(void)
{
unsigned char Count;
unsigned long Round_Reg;
unsigned int Ver_Reg;
Code_Reg=0;Ver_Reg=0;
for(Count=31;Count>0;Count--)
{
;
/*This contains the instruction to read one bit of the POCSAG code and store this bit in Flag_Bits.POCSAG*/
;
Code_Reg<<=1;Ver_Reg<<=1;
if(Flag_Bits.POCSAG){Code_Reg++;Ver_Reg++;}
if((Ver_Reg&0x400)>0)Ver_Reg^=0x769;
}
if(Ver_Reg>0)
{
Flag_Bits.VER_ER=1;Round_Reg=1;Count=31;
do
{
if(Ver_Reg==Err_s[--Count])
{
Code_Reg^=Round_Reg;
Flag_Bits.VER_ER=0;break;
}
Round_Reg<<=1;
}while(Count>0);
}
;
/*Read the last bit of the POCSAG code (parity check) and store it in Flag_Bits.POCSAG*/
;
Code_Reg<<=1;if(Flag_Bits.POCSAG){Code_Reg++;}
}
1. A careful colleague suggested that the error correction section should be modified as follows:
if(Ver_Reg==0)
{
Flag_Bits.VER_ER=0;
}
else
{
Flag_Bits.VER_ER=1;Round_Reg=1;Count=31;
;
;
}
His suggestion is good. After the modification, Flag_Bits.VER_ER can strictly reflect the result of verification or error correction. Colleagues should pay attention to it when quoting this program.
In fact, in the original program, "/*Here is an instruction to read one bit of POCSAG code and store this bit in Flag_Bits.POCSAG*/" includes a software filtering program. Flag_Bits.VER_ER is used here to reflect the success or failure of software filtering. If the software filtering cannot determine whether the current received signal is 0 or 1, Flag_Bits.VER_ER is set to 1 and immediately returns to the upper program. Therefore, Flag_Bits.VER_ER is cleared before executing verification and error correction. According
to the same characteristics of the BCH code error detection algorithm and the algorithm for generating the check code, the generation program of the POCSAG code check code can be slightly modified in this program (of course, the error correction part must be discarded), and I will not repeat it here.
Previous article:Powerful clock interrupt
Next article:Practical application of controlling the forward and reverse rotation of stepper motors
Recommended ReadingLatest update time:2024-11-16 16:38
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- PIC16F15324 microcontroller serial port interrupt cannot enter
- High-speed PCB design technology (Chinese)
- A case of SPI communication malfunction
- EEWORLD University Hall----On-time Atom LWIP Video Tutorial
- C6000TM Multicore DSP + Arm SoC Open Source
- 【TI recommended course】#Lecture on basic knowledge of electronic circuits#
- Breakthrough TI BAW technology advances big data amidst the flood of information
- FPGA Learning Notes-----FPGA Competition Adventure
- Share: Component Failure Analysis Methods
- 7 good habits of PCB layout engineers