Switch to full style
PIC Assembly Articles
Post a reply

Read input from SWITCHES and PORTS

Wed May 15, 2013 9:45 pm

Read input from SWITCHES and PORTS
Code:

TITLE 
"READ SWITCHES"
list 16f877
include <p16f877.inc>
BANK0 macro
bcf STATUS
,RP0
bcf STATUS
,RP1
endm
BANK1 macro
bsf STATUS
,RP0
bcf STATUS
,RP1
endm
BANK2 macro
bcf STATUS
,RP0
bsf STATUS
,RP1
endm
BANK3 macro
bsf STATUS
,RP0
bsf STATUS
,RP1
endm
STOREDATA EQU 0x20 
;STORE FOR SWITCH DATA
ORG 0 
;START ADDRESS
NOP
GOTO START 
;PROGRAM START
 
ORG 0x20
START CALL INITP 
:INITIALISE PORTS
REPEAT
MOVF PORTA
,;READ PORT A
MOVWF STOREDATA 
;STORE DATA

GOTO REPEAT 
;REPEAT FOREVER
PORT INIT ROUIINE
INITP BANK1
MOVLW 06 
;MAKE PORT A DIGITAL
MOVWF ADCON1
MOVLW 0xFF
MOVWF TRISA 
;MAKE A INPUT
BANK0 
;BACK TO BANK 0
RETURN
END




Post a reply
  Related Posts  to : Read input from SWITCHES and PORTS
 Read input from ports and print it on the LEDs     -  
 Ethernet Switches     -  
 Write data to ports     -  
 interminert connection to gsm network using virtual ports     -  
 input suggestion using Javascript     -  
 getting a full line input     -  
 Input-Output Operations     -  
 Only numeric input in JTextField     -  
 Input username and password in JAVA     -  
 Google Chrome input file     -