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]
 
Share



You might also like...


Arduino Uno VS Arduino Due VS Arduino Mega Pi benchmark

Ten poisonous foods that we all like eating (almost) [Biology]

The History of the LED [Education]

Physical Structure & Configuration of DC Machines [Education]

These are the worlds deadliest poisons [Biology]

This is how much (or little) water exists on, in and above Earth [Science]

Thermodynamics predicts the gruesome fate of the Universe [Science]

The geekiest (seriously) jokes explained [Mathematics]


<< Back to INDEX



Comments

  Name

  Email (shall not be published)

  Website

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