Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
C Programming for microcontrollers (Joe Pardue, 2005).pdf
Скачиваний:
272
Добавлен:
12.08.2013
Размер:
4.55 Mб
Скачать

Chapter 6: C Functions and Program Structures

#Target file name (without extension). TARGET = PC_Comm

#List C source files here. (C dependencies are automatically generated.)

SRC = $(TARGET).c

SRC += CommDemo.c

Using CommDemo:

Download the code to the Butterfly.

Open HyperTerminal

Start the program.

In HyperTerminal you should see:

PC_Comm.c ready to communicate.

You are talking to the PC_Comm demo.

Type in: demo?

You should receive:

You are talking to the PC_Comm demo.

Type in: hello

You should receive:

Hello yourself

Type in: coo

You should receive:

You sent: '' - I don't understand.

Type in: comma123

You should receive:

Thank you for sending the number: 123

106

Chapter 6: C Functions and Program Structures

Type in: commb4567

You should receive:

Thank you for sending the number: 4567

Type in: commc123456789012

You should receive:

Error - Commc number too large

Type in: commd890

You should receive:

Thank you for sending the number: 890

This is a lot of software. Don’t worry about he PC_Comm yet, but you should fully understand the demonstrator.c and demonstrator.h files by now. If not, carefully review.

107