16Bit - Compress Bits

Status
Not open for further replies.

Suraj143

Active Member
LFFFLLHHFLFF = 12bit Data

I have 12bit data that needs to store in microcontroller (in EEPROM).The problem is apart from Low (L) & High (H), there is high impedance states named "F" in the incoming protocol.

Is there any possibility to save this 12bit data with two bytes (Without using three bytes)?

Thanks
 
If it's binary digital, then it's HIGH or LOW, there's no alternative state - if there's a 'high impedance' state then that means it will be either HIGH or LOW, so store accordingly.

Exactly what is the data, where is it from, and what is feeding in to?.
 
This data from PT2262 Remote Transmitter Code.
 
This data from PT2262 Remote Transmitter Code.
I suspect you're stuffed then

Have a look at the various Arduino examples and libraries, and see what they do - Arduino is always a good place to look as there's so much stuff out there (then port the code to whatever you're using).
 
No.
With a suitable table lookup, you could pack five, three-level values in to each eight bits of storage, using 243 out of 256 bit combinations.

That means a maximum of ten, three level states in 16 bits.

Using byte-wide storage, you will have to use 24 bits, in which case you can just use two bits per three level value for the 12 bits, with no other coding.
 
If you are looking at the serial data between the encoder and decoder then it can only be zeros and ones as it is just switching a radio or IR signal on or off.

Les.
 
Depending on how fast you need to read/write you may get away with a winzip type compression, (not the winzip part) for example your data is 8 bit ,but it only sends 16 different instrusctions, so then you can convert that in to a 4bit value, ie 1= 111111111111, 2=101010101010...ect.... (winzip part) a winzip compression would take those values and group patterns, so data= 0,1,0,1,0,1 ,1,1,1,1 ,0,1,0,1,0,1 would create a table of A=0,1,0,1,0,1 B=1,1,1,1 and the compression data would be ABA.
 
Not familiar with the PT2262, but can you just detect the open circuit condition, perhaps using high resistance voltage divider connected to the data line and when detected, with a comparator circuit, skip storage of that bit. It would require some care to assure that what is being sampled is during a time that the data line would have settled to the high, low, and High Z state.
 
Since data rate seems quite low seems like an algorithm in code
would be sufficient to strip out "F"s. Or a simple state machine to
do the stripping.


If you wanted to build the state machine in HW I would consider a
PSOC or low end cpld to implement that.


Regards, Dana.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…