MCU POCSAG code error detection and correction

Publisher:脑电狂潮Latest update time:2012-06-26 Source: 21ic Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

*/ ***** 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.

Keywords:MCU Reference address:MCU POCSAG code error detection and correction

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

51 single chip microcomputer gy906 temperature measurement, voice broadcast, eepromc storage
This is a small design I made last year, mainly used to measure body temperature. Due to the special situation this year due to the epidemic, I wanted to share this design, but I found a problem when I was looking for materials on Taobao. The prices have all gone up, which is a bit uncomfortable. I also downloaded the
[Microcontroller]
51 single chip microcomputer gy906 temperature measurement, voice broadcast, eepromc storage
Make the 51 single-chip eight-segment digital tube light up
1. Basic part of eight-segment digital tube 1. Common cathode and common anode of eight-segment digital tube An eight-segment digital tube is composed of eight segments of diodes, namely a, b, c, d, e, f, g, dop (dots), with a total of eight segments. There are two types of digital tubes, common cathode and common ano
[Microcontroller]
Make the 51 single-chip eight-segment digital tube light up
Single chip microcomputer traffic light control program and design principle
When students are learning technology, they must use their brains more. When they encounter a problem, they should think twice before asking. Sometimes, what you think is just a little bit away from the truth, but you don't persist. It's only after others tell you that you suddenly realize it. The conclusions you get
[Microcontroller]
Simple 8-key electronic keyboard program for single chip microcomputer
Schematic diagram of a simple 8-key electronic keyboard: The microcontroller source program is as follows: /******************************************************************* ******************************************************************** ********* 51 Simple Keyboard Program ***************** ******************
[Microcontroller]
Simple 8-key electronic keyboard program for single chip microcomputer
The difference between the PIC series microcontroller and the MCS-51 series microcontroller in design
It should be said that there are three main characteristics: (1) Bus structure: The bus structure of the MCS-51 microcontroller is the von Neumann type. The computer fetches instructions and data in the same storage space, and the two cannot be performed at the same time; while the bus structure of the PIC microcontro
[Microcontroller]
51 single chip microcomputer flashes a small light
Let the light flash, and achieve the purpose through delay: /*-----------------------------------------------      Content: Light up one LED at port P1 and make it flash          This program is the simplest and most basic in microcontroller learning.          Learn how to control the high and low levels of the po
[Microcontroller]
Knowledge of base conversion in single chip microcomputer
1. How to convert a four-byte hexadecimal number to a decimal number. The format of the hexadecimal number is low-order first. Assume that the first byte is hex_buf , hex_buf , hex_buf , hex_buf . method: uint64 add_sum =0; sum += hex_buf ; sum += hex_buf 8; sum += hex_buf 16; sum += hex_buf 24;
[Microcontroller]
Summary of the eight advantages of PIC microcontrollers
As one of the work contents of many people, PIC microcontroller plays an important role. But most people don't know why to use PIC microcontroller. To solve this problem, we must talk about several major advantages of PIC microcontroller. Through this article about the advantages of PIC microcontroller, I hope that re
[Microcontroller]
Summary of the eight advantages of PIC microcontrollers
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号