ChipCenter Questlink
SEARCH CHIPCENTER
Search Type:
Search for:




Knowledge Centers
Product Reviews
Data Sheets
Guides & Experts
News
International
Ask Us
Circuit Cellar Online
App Notes
NetSeminars
Careers
Resources
FAQ
EE Times Network
Electronics Group Sites

Getting the Routine Down


Circuit Cellar Online
THE MAGAZINE FOR COMPUTER APPLICATIONS
Circuit Cellar Online offers articles illustrating creative solutions
and unique applications through complete projects, practical
tutorials, and useful design techniques.

WORKING WITH A LITTLE EE

Lessons from the Trenchesby George Martin

StartThe BasicsGetting the Routine DownDebugging Your Reads and WritesSources

GETTING THE ROUTINE DOWN

At a quick glance, it's encouraging to be able to write just a few routines to manage the device. Table 1 extracts some of the routines developed in EEmem.c.

Table 1—All it takes is a few routines to manage Microchip’s 24C32P. Download EEmem.c to see how I’ve implemented the routines into my code.
Function
Prototype
Start an EE transfer
void EE_start(void)
Stop an EE transfer
void EE_stop(void)
Read the acknowledge
char read_ack(void)
Write an EE bit
void wr_EEbit(char b)
Read an EE bit
char rd_EEbit(void)
Read a character
char EEread_char(int i)
Write a character
void EEwrite_char(int i, char c)


These are basic bit operations, which can be built into larger functions. If you check out the datasheet (
www.microchip.com), there are some timing requirements to consider.

Clock high (min): 4000 ns
Clock low (min): 4700 ns
Output valid from clock (max): 3500 ns
Bus free time (min): 4700 ns

The EE memory I'm writing about has a vintage 1995 datasheet. The microprocessor I used is an 80C196, operating at about 10 MHz. As you can see in the code, I don't have to worry about going too fast for the device. Because 1995 is ancient history in today's world of technology, check and double-check your datasheets.

I didn't attempt to streamline these routines in any way. For my project, the EE memory's reads and writes were so infrequent that it wasn't necessary. Also, I reserved a place for a delay routine that wasn’t needed since the microprocessor did not exceed the timing requirements of the EE device.

   PREVIOUSNEXT


Circuit Cellar provides up-to-date information for engineers. Visit www.circuitcellar.com for more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com or subscribe online. ęCircuit Cellar, the Magazine for Computer Applications. Posted with permission.
Click here to get your listing up.

Copyright © 2003 ChipCenter-QuestLink
About ChipCenter-Questlink  Contact Us  Privacy Statement   Advertising Information  FAQ