READ WRITE BITS and BYTES

Camerart

Member
Hi,
When setting up a chip, I have to WRITE specific BITs into the registers.
In order to check them, I then READ them back.
When I READ I see them on a serial output as Ascii Decimal, so not as writen to the chip which would lokk like this e,g, 0x1B.
What method do you use to mentally or otherwise check them when you do similar please?
Camerart.
 

Camerart

Member
One is represented as a hexadecimal the other as a decimal. You can easily convert them. Instead of each digit's order of magnitude being a factor of 10, it is 16 for hex. Or use any one of the calculators like https://www.rapidtables.com/convert/number/decimal-to-hex.html
Hi C,
I don't generally use a smart phone, but I have an old one, for APPS. On mine there is an APP that shows DEC,HEX and BIN, where each can be changed, so it is very visual. I can use this, but I wondered if programmers may use a simple way in their heads.
Thanks,
C.
 

Cromewell

Administrator
Staff member
You can cheat for smallish numbers. 0xFFF is 4095, 0xFF is 255, 0x0F is 15. It can help to go to binary first, then it is just power of 2 math. each digit is 4 bits. f = 1111
 

Camerart

Member
You can cheat for smallish numbers. 0xFFF is 4095, 0xFF is 255, 0x0F is 15. It can help to go to binary first, then it is just power of 2 math. each digit is 4 bits. f = 1111
Hi C,
I predict mistakes, so I'll stick to the phone.
I ask questions on other forums, and where I sometimes like %00000000, as I'm refering to PINS, I get replies 0X00, and wondered if the replier had it in his head, but they probrably look it up as with a phone.
Thanks,
C.
 

Cromewell

Administrator
Staff member
It really depends. If it's simple math ie a small enough number, I'll do it in my head, but otherwise I'll use a calculator because it's faster.
 
Top