bit manipulation - Error codes OR'd together -


i having trouble figuring 1 out , use help. data sheet hardware says "the reported error code or’d result of each detected error. error codes given in table 3."

table 3

0x00 -> no error 0x01 -> power error 0x02 -> receiver error 0x03 -> transmitter error 

the data sheet shows example.

example : (etv001t0c) + checksum -> test status 0x0c (rx , tx error) 

0c error byte. first question - math wrong? have no idea getting 0c from. pretty sure 0x02 | 0x03 = 0x03. , second if 0c how figure out errors in that?

the table giving giving bit shift positions, used << operator.

1 << 0x00 = 0001b (?) -> no error 1 << 0x01 = 0010b -> power error 1 << 0x02 = 0100b -> receiver error 1 << 0x03 = 1000b -> transmitter error 

using python calculator:

>>> (1 << 2) | (1 << 3) 12 >>> hex((1 << 2) | (1 << 3)) '0xc' 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -