how to convert thermometer code to binary one ?

Thread Starter

raika.sorena

Joined Oct 23, 2013
2
Hi every one
i want to convert a thermometer code with 119 bit to binary one in SIMULINK Matlab
how i can do it?
is there any block ?
or
how can i do it with a code ?
is there any formula to convert thermometer code to binary ?
please help me ASAP.

best regards
 

WBahn

Joined Mar 31, 2012
30,082
It's basically a unary code (sorta) in which the value is equal to the number of leading bits of the same type (or one more than the value if 0 is a valid value). So you've got

Value|Encoding
0| 10
1| 110
2| 1110
3| 11110
..|
12| 11111111111110
..|

@OP:

There are several ways to approach this, depending on what your requirements and resources are. Are the bits coming in serially? Are they available in a vector all at once?
 

THE_RB

Joined Feb 11, 2008
5,438
If there is always 119 bits per sample, you can just get the average number of 1 bits per 119 bits to get an accurate reading. No counting or segmentation is needed, just real time averaging.
 
Top