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

Answer2


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.

Archive

WHAT'S YOUR ENGINEERING QUOTIENT?

Test Your EQ•Step up to the Plate.

Problem 2How many bytes of storage space are sufficient for storing the context information for a context switch on an 8051? (The 8051 has 8 8-bit general purpose registers R0-R7, a 16-bit data pointer, a 16-bit program counter an 8-bit stack pointer, and an 8-bit program status word or PSW.)


Answer:

Six bytes! This is achieved by not saving the general-purpose registers, and saving only the data pointer, program counter, stack pointer and program status word. The 8051 has a special feature that makes this possible. The general-purpose registers are mapped into the first 32 bytes of internal ram. By setting the PSW register, you can specify whether the general purpose registers map to the first, second, third or fourth bank of 8 bytes of internal ram. Of course this imposes a limitation that your application must have no more than four unique contexts. However, this makes for a very fast context switch.

12-99


For questions or comments about
Test Your EQ, e-mail eq@circuitcellar.com
.
Click here to get your listing up.

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