Serial port ASCII and HEX terminal functions.
What's ASCII and HEX format?
Data in the form of text and numbers are used for programming the electronic devices. But computers cannot understand human language. They can only understand the data in the form of 0’s and 1’s. To make data interpretable by computer many number formats are being used. Some of them are the Binary number system, Octal number system, Hexadecimal number system, etc.. To make the text understandable by computers ASCII codes are used. Internal converters are used for converting data from one format to another. Hexa to ASCII conversion is discussed below. Computers refer to a standard ASCII code table for reference.
What is the Hexadecimal format?
Hexadecimal Number System is a positional number system system used to represent numbers. It uses sixteen symbols to represent the numbers, hence the name ‘HEX’. Symbols used by hexadecimal ar ‘ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.’ Hexadecimal number system uses alphabets as symbols along with the numerical. The symbols ‘0-9’ are used to represent the numbers 0-9. The symbols ‘A-F’ are used for representing numbers from ten to fifteen. Hexadecimal representation of numbers requires four decimal bits for each digit.
What is an ASCII Code?
ASCII stands for – American Standard Code for Information Interchange. It is one of the milestones of IEEE. It is a character encoding standard for electronic communication for representing letters and alphabets in computers, electronic devices, etc…ASCII was developed in the US, using the Telegraph code. In 1963 the first edition of ASCII code was published. It underwent much revision over the years, and the latest update was done in the year 1986.
ASCII code is based on the English Alphabet. It has 256 character codes, which also includes 127 specified characters.
ASCII code is divided into two sets – Standard ASCII code and Extended ASCII code. Standard ASCII code represents characters such as ‘a’ to ‘z’ and digits ‘0’ to’9′. They range from 0-127 in decimal and from 00 to 7F in Hexadecimal format. These are also known as Printable characters. The code ranging from 0 to 31 contains control characters assigned to control the peripheral devices and are not printable.
Extended ASCII codes contain the symbols and characters which are mostly used in different languages. They range from 128 to 255 in decimal or 80 to FF in Hexadecimal. Extended codes, along with the Control codes present in Standard ASCII code, are used for various communication protocols such as RS=-232, RS-485, RS-422, TTL. With the advent of time, many modifications are made in ASCII to include non-English languages.
Why are ASCII and HEX so important to show in Serial Port?
Most of the Serial Communication is based on bytes that are not always printable. The printable characters goes from HEX value 0x20 to HEX value 0x7F. (
To have a better idea of the ASCII printable characters please refer to this table).
Here is when the HEX byte print out if important while using Serial Communication and SerialTool allows you to show ASCII and HEX bytes at the same time.
With the appropriate serial incoming and outgoing timestamp you can quickly spot the received and transmitted bytes via serial port.
This is and extermely useful function when you what to debug your serial port communication.
For example if you are using the Arduino Serial Monitor function in the Arduino IDE you cannot see incoming and outgoing bytes unless you make your own "printf" function.
SerialTool helps you in that task effortlessly.
ASCII and Hexadecimal Termnial screenshot