Getting Started

(lily) #1

Chapter 8: C Pointers and Arrays


d to the PC_Comm.c file:

Send a string located in Flash ROM
id se as Str)

inates if the byte is '\0' or if i = 60.
pointer
60; i++)

on

he oscillator:
ation();
// Initialize the USART
USARTinit();
ions on PC

'0';

void sendFString(const char *);


Ad


//
vo ndFString(const char *pFl h
{
uint8_t i;


// The 'for' logic term
// '\0' is 'null' and terminates C strings
// 6 vents too much overrun if we get a bad The 0 pre
// and it limits the string size
for (i = 0; pgm_read_byte(&pFlashStr[i]) && i <
{
se r(pgm_read_byte(&pFlashStr[i])); ndCha
}
}


Change Demonstrator.h to:


// Demonstrator.h Messenger version


void initializer(void);
void parseInput(char *);
void showMessage(char);


Change Demonstrator.c to:


// Demonstrator.c Messenger versi


#include "PC_Comm.h"
#include "Messages.h"


vo
id initializer()
{
// Calibrate t
OSCCAL_calibr


// Display instruct
sendFString(TALKING_TO);
sendFString(WHO_DEMO);


char c =

Free download pdf