As a final step, I added an END command to mark the
end of the program. This is always a safe way to complete
a PICBASIC PRO command.
' Mark End of Program ***
The SPI Demo Board has several different SPI chips to
talk to. The SHIFTIN/SHIFTOUT commands can be used
to talk to any of them. SPI communication is really easy to
understand, once you get the basics down. The problem is
that it takes up more I/O with all the extra CS pins for
each SPI chip you use. This is an advantage to I2C that I
covered in my previous column. SPI is typically faster
than I2C, though, so it can sometimes offer an advantage.
However, if the EEPROM takes 10 milliseconds to
complete a write operation, that becomes the limiting
I like to think about next steps for all my projects so
the reader can take what I taught them and prove to
themselves that they understand it by going further with
the same hardware. This setup lends itself perfectly to
that concept. The SPI demo board has multiple chips on
which to experiment. Each chip requires you to read the
datasheet for any command codes required, but these
are all free to download from www.microchip.com.
The CS line on the demo board was designed for
one-chip communication only, with jumpers to select
the chip. Communicating with multiple SPI parts requires
you to create jumper wires from the MCU's extra CS
lines to the CS connections on the demo board. This
could be an interesting project — I just didn't have time
to try it.
Another source of information regarding serial
EEPROMs is the Microchip "Recommended Usage"
application note for SPI Serial EEPROMs (AN1040) and
the datasheet for the 25LC020. Both are also available for
download at www.microchip.com.
Let me hear your feedback on this column or previous
columns. I've gotten some email from people who are still
working on projects from the 2006 articles. If you missed
these, they’re compiled together in a book entitled
Getting Started with PICs (2006) that you can purchase
from the Nuts & Volts webstore ( http://store.nutsvolts.
com). Just shoot me an email at email@example.com,
and type Nuts & Volts in the subject line so it doesn't get
lost among the numerous junk emails I receive. See you
NOTE: The Microchip name and logo, and PIC are registered trademarks of
Microchip Technology, Inc., in the U.S.A. and other countries. PICkit is a trademark
of Microchip Technology, Inc., in the U.S.A. and other countries. All other
trademarks mentioned herein are property of their respective companies.
Complete Fabrication Center
Quality prototype parts within 24 hours!!
Precision Laser, Waterjet, Plasma, Machining,
Micro-Machining, Forming, and Welding Capabilities
Parts from practically any material
and from 0.001” to 6.000” in
Finishes such as powder coat,
paint, plating, anodizing, silk
screen, and more!
Fabricated, silkscreened and
shipped in 2 business days
with no expedite charges!
* No Minimums
24 hour turn time based on quantity and finish requirements
Integrated Ideas & Technologies, Inc.
6164 W. Seltice Way • Post Falls, ID • 83854 • USA
Ph (208) 262-7200 • Fax (208) 262-7177 •