Getting Started

(lily) #1

Chapter 8: C Pointers and Arrays


ng the byte 4-bits, which we use as the ASCII
haracter offset.

e’ll use these ideas in the showClock function in the software.

he Real Timer Clock Software

encounter: uint8_t, which is WinAVR specific and
y we called ‘unsigned char’ and is the same as a byte.

reate .h files and the

PROGMEM = "'Real Time Clock' demo.\r";

MEM = "\rYou sent: '";
onst I don't understand.\r";

const
const char TEXT_GET[] PROGMEM = "'get' to get the time and
date.\
onst to set the second";
MIN[] PROGMEM = "'minXX' to set the minute";
HOUR[] PROGMEM = "'hourXX' to set the hour";
onst char TEXT_TOXX[] PROGMEM = " to XX.\r";


pen Demonstrator.h and write:

Finally we get the Tens by right shifi
c


Tens = (Tens >> 4) + '0';

W


T


In the software you will
denotes what would normall


C a new directory, Real Time Clock, and copy the .c and
makefile from the Messenger directory.


Open Messenger.h in Programmers Notepad and write:


// identify yourself specifically
const char TALKING_TO[] PROGMEM = "\rYou are talking to the ";
const char WHO_DEMO[]


// bad command
const char BAD_COMMAND1[] PROG
c char BAD_COMMAND2[] PROGMEM = "' -


char ENTER[] PROGMEM = "Enter ";

r";
c char TEXTSEC[] PROGMEM = "'secXX'
const char TEXT

const char TEXT_
c


const char ERROR_NUMBER[] PROGMEM = "\rERROR - number must be
less than ";
const char ERROR_60[] PROGMEM = " 60.\r";
const char ERROR_12[] PROGMEM = " 12.\r";


const char THE_TIME_IS[] PROGMEM = "The time is: ";


O

Free download pdf