This is the code Matt Damon and NASA use to communicate in 'The Martian'

In addition to a limited supply of food and water, Watney has no
idea how he’s going to make contact with another human being or
how he’ll get home.

The next mission to Mars isn’t scheduled to arrive for another
four years. NASA thinks he's dead, and, even when they figure out
he is alive through satellite images, they still have no way to
communicate with him.

The main communications dish was battered in the storm. The
other three backup communications systems were located in
the Mars Ascent Vehicle (MAV), which the rest of Watney's
crew took with them when they left Mars, believing him dead
from the storm.

So in order to gain contact with NASA, Watney digs up the Mars
Pathfinder, the probe which NASA lost contact with in 1997.

He fixes it (woo!) and the probe is able to communicate with
Earth. Through a camera on the Pathfinder, Watney is able to
speak to NASA through messages he writes and shows to it.

While they find an easier means of communication later in the
book and film, for their first contact they only have the
Pathfinder to communicate through and that results in a few
problems.

For instance, Watney has a limited amount of paper to write
on. The larger problem? NASA can't communicate back. All
they have is a camera on a platform which can rotate 360
degrees.

That's a start. The camera can point to things like "yes" and
"no." It can even point to an alphabet. However, since the camera
moves in a circle, it doesn't leave a whole lot of room for each
of the English language's 26 letters.

Watney has to get creative.

So he decides to use a hexadecimal system, which has
16 characters, to communicate instead.

In the movie, Watney brings it up with little further
explanation.

So, what is the hexadecimal system you see on
screen?

The hexadecimal system is comprised of 16 symbols: 0-9 and
A-F.

Typically it's used by programmers to condense and
communicate large binary numbers easily.

It's also used to communicate data.

After putting signs for the 16 digits and numbers in a
circle around Pathfinder, Watney combines the hexadecimal
system with an ASCII table in both the book and movie. ASCII is a
code that represents characters as numbers and is used to help
display text onto computers among other devices.

An ASCII table contains 255 characters where each is assigned a
number ranging from 0 to 255.

An easier way to think of it is by considering all the
options on a smartphone keyboard. Now, imagine you only had 255
of those characters to choose from and each of those was assigned
a number from 0-255. That's your ASCII table.

1. HOW ALIVE — NASA's way of asking Watney how he has survived
for nearly 100 Mars days at this point.
2. CROPS? — NASA's wondering how in the world Watney was
able to grow food on a planet where that's supposed to be
impossible.
3. BRING SJRNR OUT — NASA'S telling Watney to bring the Sojourner
rover out near the Pathfinder to try and figure out an
easier means of communication.

As you can see, it's a rather time-consuming process which
isn't ideal for lengthy conversation.Watney refers to their
system as a
Speak & Spell in the book.

I made it a little easier by giving you each character as two
digits when Watney would really just be seeing everything as one
character at a time. (In other words, HOW ALIVE would look like
484F57414C495645 instead of 48 4F 57 41 4C 49 56
45).

While effective at first for communication, it's not long before
they find a simpler way later on to eventually type messages out
to one another.