in the RS-232 box of
Now we’re ready to
send some characters. I
set up a Tera Term Pro
session on my personal
computer and tuned it
in for 9600 bps. I then
wrote the C code you
see at the bottom of
Listing 5. The code
sends the string NUTS
& VOLTS continually.
The string I defined at
the beginning of my
code is actually stored in the PIC10F206’s program Flash
area and is automatically terminated with a null or zero
character by the HI-TECH PICC C compiler.
I’ve pulled the psect that details how the characters in
the string are stored and placed it under my code so you
can see how the HI-TECH PICC C compiler handles strings
in the Flash memory area. Putting the string in the program
Flash memory area is a good thing, as the PIC10F206 doesn’t have enough SRAM to hold the string and do other
SRAM related things at the same time. Pretty clever, huh?
The null character that signifies the end of the string
comes in handy, as I can simply test for it as I send characters
HI-TECH PICC C compiler
MPLAB ICE 2000
EDTP Electronics, Inc.
Digital Filter Development Board
Listing 5. This code takes up almost half of the PIC10F206’s
program Flash. That still leaves enough room to make effective
use of the serial port this code creates.
// * IMPORTANT: Compile this file with FULL
// * Copyright (C)1996 HI-TECH Software.
// * Freely distributable.
// * Adapted for use with the PIC10F20X by Peter
Serial port driver (uses bit-banging)
for 16Cxx series parts.
__CONFIG(MCLRDIS & WDTDIS & UNPROTECT);
//Transmit and Receive port bits
#define SERIAL_PORT GPIO
#define SERIAL_TRIS TRIS
#define TX_PIN 2
#define RX_PIN 3
#define XTAL 4000000
Learn at home in your
Earn up to
$100 an hour
No previous experience needed!
You can earn more money
if you get an FCC License!
Not satisfied with your present income?
Add prestige and earning power to your
electronics career by getting your FCC
The Original Home-Study course prepares you for the “FCC Commercial
Radiotelephone License” at home in your
This valuable license is your professional
“ticket” to thousands of exciting jobs in:
Communications, Radio-TV, Microwave,
Maritime, Radar, Avionics & more…you
can even start your own business!
No need to quit your job or go to school.
This proven “self-study” course is easy,
fast and low cost!
GUARANTEED TO PASS – You get your
FCC License or your money will be refunded.
Call for FREE facts now!
(800) 932-4268 Ext. 220
FCC LICENSE TRAINING - Dept. 220
P.O. Box 3000 • Sausalito, CA 94966
Please rush FREE details immediately!
City State Zip
Circle #135 on the Reader Service Card.