Recent

Author Topic: 60 bits of config, some spare. Can I store > 2^'spare bits' extra info?  (Read 831 times)

741

  • New Member
  • *
  • Posts: 27
This relates to a smoke detector (non-safety application), the RE46C200, inside which are 60 bits of configuration, covering things such as horn style, thresholds etc.

For the application in mind, several bits are "don't care" - but not many, maybe 10 bits.

Suppose I'd like to store a short string where characters are from the set [a-z0-9], so the set has cardinality 36. That seems to need 6 bits per character because 32 < 36 <= 64

There are various settings that do matter, and these settings may be adjusted according to a given environment.

Let's suppose there is a customer 'abc01'  (5 characters) and further assume there are not (5 *6 = 30) bits spare.


Is there some way I can combine the 50 bits of 'important settings' with the 10 bits 'spare' such that those 10 bits actually impart more than 10 bits worth of meaning? That is, the 10 bits yield abc01, or whatever we call some customer.

In  particular, suppose a given customer has two use-cases for the detector and these need different settings. In both situations, it there a way to combine 'some carefully chosen' 10 bits worth of 'spare' data with the settings so as to 'reveal'  the (same) customer ID string?

I should add that I appreciate this might be not possible, but I'm not 100% certain and thought I'd ask  :-\

alpine

  • Hero Member
  • *****
  • Posts: 1412
Re: 60 bits of config, some spare. Can I store > 2^'spare bits' extra info?
« Reply #1 on: February 11, 2024, 04:33:00 pm »
You can use those 10 bits for an index in a LUT stored locally.
"I'm sorry Dave, I'm afraid I can't do that."
—HAL 9000

jamie

  • Hero Member
  • *****
  • Posts: 7770
Re: 60 bits of config, some spare. Can I store > 2^'spare bits' extra info?
« Reply #2 on: February 11, 2024, 05:01:14 pm »
There are BITPACKED records.

Code: Pascal  [Select][+][-]
  1. Type
  2.  TMyConfig = BitPacked record
  3.  
  4.    First_Field :0..3;
  5.    Second_Field :0..4;
  6.   ....
  7. end;
  8.  

The compiler will allow you to access them as standalone entities but the complete record can represent the field.
The only true wisdom is knowing you know nothing

Kays

  • Hero Member
  • *****
  • Posts: 632
  • Whasup!?
    • KaiBurghardt.de
Re: 60 bits of config, some spare. Can I store > 2^'spare bits' extra info?
« Reply #3 on: February 11, 2024, 08:45:15 pm »
[…] such that those 10 bits actually impart more than 10 bits worth of meaning? That is, the 10 bits yield abc01, or whatever we call some customer. […]
There are 365 different five‑character strings. Ten bits can convey 210 distinguishable states. You do the arithmetic. And that’s just if the string is always exactly 5 characters long.

Data compression won’t work, so, like Alpine suggested, you need to restrict the domain of values you want to store. Probably there will be no customer going by the name hhhhh, so it is not necessary to be able to store this value. Storing the key to a lookup table is probably the easiest. You could skip an LUT if customer identifiers are always valid FreePascal identifiers: Just define an enumeration data type and use the associated RTTI.

PS: Are you absolutely sure those 10 bits or so you intend to use are really irrelevant? Usually manufacturers mark bits as reserved: In a future revision of the same product the bits suddenly have a specific meaning.
Yours Sincerely
Kai Burghardt

 

TinyPortal © 2005-2018