Home     Contact     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science     RSS     Terms of services     Privacy policy  
 Home      Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science   

<< Back to INDEX

Read Modify Write Problem with PIC Microcontrollers [Education]
posted June 17 2014 9:34.11 by spic0m

Ligo George writes at electroSome about a common problem found on mid-range PIC microcontrollers:

"Microchip's mid-range PIC Microcontrollers use a sequence of operations : Read, Modify and Write to change output state of a pin. In certain circumstances RMW operations might cause unexpected behavior of outputs. You might have already experienced this issue and struggled with it as you can't find exact reason with microcontrollers unexpected behavior. Mid-Range PIC Microcontroller uses two registers, TRIS and PORT to control the direction and status of an IO pin respectively.

When you try to change the status of a specific pin, consider 7th bit of PORTB (RB7), the microcontroller reads all 8 bits of PORTB register and stores this data in a temporary register. Then modifies the 7th bit as per the instruction and the modified data is written back to PORTB. This process of modifying the output of a pin can cause unexpected behavior as the PORT Read operation reads the actual state of physical pin.

The actual physical state (voltage level) of a pin may be different from the value written to PORT register in certain instances. For example,

When the output pin is connected to high inductance or capacitance loads.
When the output pin is connected to LEDs without current limiting resistors.
When the output pin drives a transistor without base resistor.
When the output pin is shorted to ground.

If a high value capacitor is connected to a pin, it will take some time to charge the capacitor when the pin is set to HIGH."

Read the article here.

[Link: electroSome]

You might also like...

How trees get so big? Where do they get their mass from? [Physics]

This is how the monetary system works - and its no funny [Economics]

Why do we cry? [Biology]

Humans are engineered to spill their coffee [Science]

How Peltier TE work - TEG Energy Harvesting Experiments [Theory]

The BJT Transistor Theory - My first TEDIE Book [Theory]

The Milgram experiment might unleash the monster within you [Psychology]

Demystifying Algorithms for all (literally) [Mind hack]

<< Back to INDEX



  Email (shall not be published)


Notify me of new posts via email

Write your comments below:
BEFORE you post a comment:You are welcome to comment for corrections and suggestions on this page. But if you have questions please use the forum instead to post it. Thank you.


No comment yet...

Be the first to comment on this page!

 Contact     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science     RSS   

Site design: Giorgos Lazaridis
© Copyright 2008
Please read the Terms of services and the Privacy policy