поискавой системы для электроныых деталей
  Russian  ▼
ALLDATASHEETRU.COM

X  

AN2159 датащи(PDF) 14 Page - STMicroelectronics

номер детали AN2159
подробное описание детали  SPI protocol for STPM01/STPM10 metering devices
PDF  23 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
производитель  STMICROELECTRONICS [STMicroelectronics]
домашняя страница  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

AN2159 датащи(HTML) 14 Page - STMicroelectronics

Back Button AN2159 Datasheet HTML 10Page - STMicroelectronics AN2159 Datasheet HTML 11Page - STMicroelectronics AN2159 Datasheet HTML 12Page - STMicroelectronics AN2159 Datasheet HTML 13Page - STMicroelectronics AN2159 Datasheet HTML 14Page - STMicroelectronics AN2159 Datasheet HTML 15Page - STMicroelectronics AN2159 Datasheet HTML 16Page - STMicroelectronics AN2159 Datasheet HTML 17Page - STMicroelectronics AN2159 Datasheet HTML 18Page - STMicroelectronics Next Button
Zoom Inzoom in Zoom Outzoom out
 14 / 23 page
background image
Data processing
AN2159
14/23
Doc ID 11400 Rev 3
5.1.1
Data register assembling example
Following an example of reading and re-arranging of STPMxx registers.
On the left are reported the eight data records as they are read, represented as
hexadecimal bytes while MSBF was cleared, on the right the corresponding register.
1.
65 7A 7C 82
DAP = 82 7C 7A 65
2.
00 7A 0C E0
DRP = E0 0C 7A 00
3.
00 00 8C 92
DSP = 92 8C 0 00
4.
00 06 6E 22
DFP = 22 6E 06 00
5.
BB B3 07 DD
DEV = DD 07 B3 BB
6.
3F AF AA CA
DMV = CA AA AF 3F
7.
01 00 00 E0
CFL = E0 00 00 01
8.
00 00 00 F0
CFH = F0 00 00 00
5.2
Parity check
Each bit of parity nibble is defined as odd parity of all seven corresponding bits of data
nibbles. In order to check the data record integrity, the application should execute something
similar to the following C code, given as an example:
int BadParity (unsigned char *bp)
{
register unsigned char prty;
/* temporary register */
prty
= *bp,
/* take the 1st byte of data */
prty ^= *(bp+1),
/* XOR it with the 2nd byte */
prty ^= *(bp+2),
/* and with the 3rd byte */
prty ^= *(bp+3),
/* and with the 4th byte */
prty ^= prty<<4, prty &= 0xF0;/* combine and remove the lower nibble */
return (prty != 0xF0);
/* returns 1, if bad parity */
}
if (BadParity(dap) || BadParity(drp) ||
/* DAP and DRP data record */
BadParity(dsp) || BadParity(dfp) ||
/* DSP and DFP data record */
BadParity(dev) || BadParity(dmv) ||
/* DEV and DMV data record */
BadParity(cfl) || BadParity(cfh))
/* CFL and CFH data record */
/* code to repeat reading sequence should be entered here */ ;
If the parity nibble check would fail, the reading task should be repeated but, this time,
without request of latching otherwise a new data would be latched and previous reading
would be incorrectly lost.
In a very hash EMI environment, it would be a good practice to read the data records twice
and then compare both reading. This way the probability of detecting bad readings would be
significantly improved. Anyway, a single bad data can be discarded because no meaningful
information is lost as long the reading frequency is about 30 ms.



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23


датащи скачать

Go To PDF Page


ссылки URL



Вашему бизинису помогли Аллдатащит?  [ DONATE ] 

Что такое Аллдатащит   |   реклама   |   контакт   |   Конфиденциальность   |   Ссылка на техническое описание    |   обмен ссыками   |   поиск по производителю
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com