Decimal value of ATAES132A counters

1 post / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

According to the datasheet the max value of a counter is 0x1FFFEE, which is 21 bits.


Section H.2 "Reading The Counter" advises using this formula to get the decimal value of a counter:


CountValue = (BinCount*32) + (CountFlag/2)*8 + Lin2Bin(LinCount)
Multiplying BinCount by 32 shifts it right 5 bits, to bits [20 downto 5].
The (CountFlag/2)*8 term then occupies bits [4:3].

This leaves bits [2:0] for the final Lin2Bin(LinCount) term. So I presume it can range 0b000 to 0b111


But the accompanying text in the datasheet mentions values 0xffff to 0x8000, which 'map' to values 0 to 15 (dec) which would overflow this 3 bit field.


Has anyone implemented this?
Is there any difference between handling the MSB or LSB of a LinCount value?
Should Lin2Bin() return 0 to 7, or 0 to 15?


I'll keep experimenting with it but any information would be a big help.


Thanks in advance.


Last Edited: Thu. Mar 23, 2017 - 05:13 PM