Page 1 of 1

Draft FAQ for "Digital I/O Ports" forum

PostPosted: Sat May 31, 2014 2:45 am
by ric
Topics
  • Port pins changing unexpectedly - the "Read-Modify-Write" problem
  • Inputs always reading as zero - Analog capable inputs default to analog mode
Port pins changing unexpectedly - the "Read-Modify-Write" problem
The following examples in Assembler and C do exactly the same thing:
Example assembler
Code: Select all
        clrf    PORTA   ;All pins low
        ....            ;some other instructions
        bsf     PORTA,0 ;raise RA0
        bsf     PORTA,1 ;raise RA1

Example C
Code: Select all
    PORTA=0;    //All pins low
    ....            //some other instructions
    PORTAbits.RA0=1    //raise RA0
    PORTAbits.RA1=1    //raise RA1


(More to write)

Inputs always reading as zero - Analog capable inputs default to "analog" mode
(To write)

Re: Draft FAQ for "Digital I/O Ports" forum

PostPosted: Sat May 31, 2014 11:20 am
by Ian.M
Some stuff you may wish to add that needs expanding:

* Capacitive Loading Specs on Output Pins 50pF max - consistent across 8 bit PIC families ever since the PIC16C devices
ToDo: Confirm loading specs for 16 and 32 bit families.
* Influence of loading and clock speed on RMW problem.
* Methods of avoiding RMW:
+ Use LATX if available (Dario's favourite 8-)
+ Shadowing
+ Avoidance by only using one output per port
+ Avoidance by only writing whole port
+ Mitigation by delays
* Link back to "RMW and solutions for it" http://www.microchip.com/forums/m478014.aspx