DatasheetQ Logo
Electronic component search and free download site. Transistors,MosFET ,Diode,Integrated circuits

PIC16C554A-04/SS View Datasheet(PDF) - Microchip Technology

Part Name
Description
Manufacturer
PIC16C554A-04/SS
Microchip
Microchip Technology 
PIC16C554A-04/SS Datasheet PDF : 108 Pages
First Prev 31 32 33 34 35 36 37 38 39 40 Next Last
PIC16C55X
EXAMPLE 5-1:
READ-MODIFY-WRITE
INSTRUCTIONS ON AN
I/O PORT
; Initial PORT settings: PORTB<7:4> Inputs
;
;
PORTB<3:0> Outputs
; PORTB<7:6> have external pull-up and are
; not connected to other circuitry
;
;
PORT latch PORT pins
;
---------- ---------
;
BCF PORTB, 7 ; 01pp pppp
BCF PORTB, 6 ; 10pp pppp
BSF STATUS, RP0 ;
BCF TRISB, 7 ; 10pp pppp
BCF TRISB, 6 ; 10pp pppp
11pp pppp
11pp pppp
11pp pppp
10pp pppp
5.4.2
SUCCESSIVE OPERATIONS ON I/O
PORTS
The actual write to an I/O port happens at the end of an
instruction cycle, whereas for reading, the data must be
valid at the beginning of the instruction cycle, as shown
in Figure 5-6. Therefore, care must be exercised if a
write followed by a read operation is carried out on the
same I/O port. The sequence of instructions should be
such to allow the pin voltage to stabilize (load
dependent) before the next instruction which causes
that file to be read into the CPU is executed. Otherwise,
the previous state of that pin may be read into the CPU
rather than the new state. When in doubt, it is better to
separate these instructions with an NOP or another
instruction not accessing this I/O port.
FIGURE 5-6:
SUCCESSIVE I/O OPERATION
PC
Instruction
fetched
RB <7:0>
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
PC
MOVWF PORTB
Write to
PORTB
PC + 1
MOVF PORTB, W
Read PORTB
PC + 2
NOP
PC + 3
NOP
T PD
Execute
MOVWF
PORTB
Port pin
sampled here
Execute
MOVF
PORTB, W
Execute
NOP
Note 1: This example shows write to PORTB followed by a read from PORTB.
2: Data setup time = (0.25 TCY - TPD) where TCY = instruction cycle and TPD = propagation delay of Q1 cycle to
output valid. Therefore, at higher clock frequencies, a write followed by a read may be problematic.
2002 Microchip Technology Inc.
Preliminary
DS40143D-page 29

Share Link: 

datasheetq.com  [ Privacy Policy ]Request Datasheet ] [ Contact Us ]