- Port pins changing unexpectedly - the "Read-Modify-Write" problem
- Inputs always reading as zero - Analog capable inputs default to analog mode
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)