Number entry and output display in HEX/DEC/BIN
Contents
SPI>o 1. HEX 2. DEC 3. BIN 4. RAW (1)>1 Display format set SPI>0b1 1 0x1 WRITE: 0x01 WRITE: 0x01 WRITE: 0x01 SPI>
The Bus Pirate terminal interface accepts numbers in three formats: hexadecimal, decimal, and binary. It also displays values in HEX/DEC/BIN and a raw byte format. This short guide explains how to enter number values into the Bus Pirate, and how to adjust the Bus Pirate number display format.
Number entry
The maximum value you can enter in any format is currently 255 (8bits/1byte).
HEX
0x0, 0x18, 0x4A, 0xFF
Hexadecimal values are base 16 numbers that use a-f for the numbers 10-15, this format is very common in computers and electronics. Enter HEX values as shown above, precede the value with 0x. Single digit numbers don't need 0 padding, 0x01 and 0x1 are interpreted the same.
DEC
0, 24, 74, 255
Decimal values are common base 10 numbers. Just enter the value, no special designator is required.
BIN
0b0, 0b11000, 0b1001010, 0b11111111
Binary values are commonly used in electronics because the 1's and 0's correspond to register 'switches' that control various aspects of a device. Enter a binary number as 0b and then the bits. Padding 0's are not required, 0b00000001=0b1.
Convert formats
1-WIRE>=0b110 0x06 = 6 = 0b00000110 1-WIRE>=0xa 0x0A = 10 = 0b00001010 1-WIRE>=12 0x0C = 12 = 0b00001100 1-WIRE>
The '=' converts between number formats.
Output display
HiZ>o 1. HEX 2. DEC 3. BIN 4. RAW (1)>1 Display format set HiZ>
The Bus Pirate terminal will display values in BIN/HEX/DEC. Change the setting in the data display format menu 'o'. The default display format is HEX.
The RAW display mode sends values to the terminal as raw byte values without any text conversion. This is useful for bus sniffers and other high-speed functions where converting raw bytes to text takes too much time. Adjust the display format in your serial terminal to see the raw values as HEX/DEC/BIN.
Comments
No comment posted.
Scan me to return to the original page.