Switch to full style
PIC Assembly Articles
Post a reply

Input-Output Operations

Sun Mar 31, 2013 8:49 pm

Input/Output Operations:
  • Each PIC microprocessor has number of ports number from port A, to port L, depends on how many pins exists in this microprocessor.
  • Each port has 3 special registers associated with it: PORTx, TRISx, and LATx.
  • TRISx is the register which responsible to set the port as input port or output port. Setting TRISx bits to zeros would make portx to be an output port, and setting the TRISx bits to ones would make portx to be an input port.

Example1:

Assign value 66H to the output port C:
asm code
MOVLW	0x0
MOVWF TRISC
L1 MOVLW 0x66
MOVWF PORTC
GOTO L1


Example2:
Make port C as input port, add 12 to it and port B as output port B:
asm code
MOVLW	B’00000000’
MOVWF TRISB
MOVLW B’11111111’
MOVWF TRISC
L2 MOVF PORTC, W
ADDLW 12
MOVWF PORTB
GOTO L2




Post a reply
  Related Posts  to : Input-Output Operations
 OUTPUT??     -  
 what is the output of this program and how it be?     -  
 output associate array by print_r     -  
 Use for loop to output HTML table     -  
 echo command to output HTML     -  
 Matrix Operations     -  
 C++ Boolean Operations     -  
 Character Operations     -  
 Operations on Sucxent++     -  
 Bit operations-set-get-xor-rotate on bits arrays     -