More Display Fun

You can make large, predefined lists with DAT blocks. You will see numerous applications of this in the lessons. This first application is simply storing some character art.

  • Open “7 More Display Fun.spin”, load it into the Propeller chip with F11, and click the Parallax Serial Terminal’s Enable button to view the output.

Use a DAT block in a Spin program to make a map of characters to display in the Parallax Serial Terminal. This is a smiley face.

How it Works

Unlike the String operator, which stores a list of characters in program memory, the DAT block is more like a pre-defined variable array. The values are loaded into RAM, and can even be modified while the program is running, much like an array.

Remember that the Parallax Serial Terminal Plus object’s Str method’s stringptr parameter expects the memory address of a zero-terminated string. Take a look at the last value in the DAT block, it’s zero. Also, take a look at the pst.Str call. It’s pst.Str(@Win). The @ opereator in @Win gives the Str method the memory address of the first byte (a space character) at the beginning of the rows of characters. So, the Str method does its job of fetching and transmitting characters until it runs into that zero at the end of the list.

Did you know? The 13 character code makes the Parallax Serial Terminal’s cursor jump to the beginning of the next line.

Your Turn

You can also treat DAT blocks like arrays. For example, here is a loop that sends each character in the DAT block, one at a time.

  • Save the program as 7a Send Characters.spin.
  • Add the variable i to the list of long variables in the VAR block. It should read long x, y, i.
  • Replace pst.Str(@Win) with this loop:
repeat i from 0 to 275 


  • Try adding a "YOU LOSE" unhappy face to the program.

Learn More about DAT

  • Look up DAT in the Propeller Manual’s index.