Deberias poner el codigo que estas usando, ya que el problema esta ahí
Corresponde a la funciones
1.so's4+s0's3+s1's2
2.s0s4'
3.s2s3'+s4's1+s1's0
4.s0s4'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PROCESSOR 16F877A
#include <xc.inc>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; CONFIGURACION;
CONFIG CP=OFF ; PFM and Data EEPROM code protection disabled
CONFIG DEBUG=OFF ; Background debugger disabled
CONFIG WRT=OFF
CONFIG CPD=OFF
CONFIG WDTE=OFF ; WDT Disabled; SWDTEN is ignored
CONFIG LVP=ON ; Low voltage programming enabled, MCLR pin, MCLRE ignored
CONFIG FOSC=XT
CONFIG PWRTE=ON
CONFIG BOREN=OFF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MEMORIA Y BANCOS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PSECT udata_bank0
max:
DS 1 ;reserve 1 byte for max
tmp:
DS 1 ;reserve 1 byte for tmp
PSECT resetVec,class=CODE,delta=2
INISYS:
;CAMBIO A BANCO 1
BCF STATUS, 6
BSF STATUS, 5 ; Bank1
;Declarando solo los bits que se van a usar (5)
BSF TRISB, 0
BSF TRISB, 1
BSF TRISB, 2
BSF TRISB, 3
BSF TRISB, 4
;Declarando solo los bits que se van a usar (4)
BCF TRISA, 0
BCF TRISA, 1
BCF TRISA, 2
BCF TRISA, 3
;REGRESAR A BANCO 0
BCF STATUS, 5
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CODIGO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
main:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MOTORI1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;PRODUCTO1
;sensor0 negado
MOVF PORTB,0 ;Mover puertoB a w
andlw 00000001; mascara para s0
movwf 22h ; guardar s0 en 22h
comf 22h,1 ; s0 negado en 22
;Sensor4
MOVF PORTB,0 ;Mover puertoB a w
andlw 00010000; mascara para s4
movwf 27h ; guardar s4 en 21h
rrf 27h ,1 ; rotar 4 veces
rrf 27h,1
rrf 27h,1
rrf 27h,1
movf 22h,0
andwf 27h,1 ; and entre s0negado(22h) y Sensor4(27h) y guardado en 27h
;PRODUCTO2
;Sensor3
MOVF PORTB,0 ;Mover puertoB a w
andlw 00001000; mascara para s3
movwf 23h ; guardar s3 en 22h
rrf 23h,1 ;rotar 3 veces y guardar en 23h
rrf 23h,1
rrf 23h,1
movf 22h,0 ; traer 22h s0negado
andwf 23h,1 ; and entre sensor3(23h) y sensor0 negado(22h) guardado en 23h
;PRODUCTO3
;s1 negado
MOVF PORTB,0 ;Mover puertoB a w
andlw 00000010; mascara para s1
movwf 24h ; guardar s1 en 24h
rrf 24h,1 ;rotar y guardar en 24h
comf 24h,1 ; s1 negado en 24
;Sensor2
MOVF PORTB,0 ;Mover puertoB a w
andlw 00000100; mascara para s3
movwf 25h ; guardar s3 en 25h
rrf 25h,1 ;rotar 2 veces y guardar en 25h
rrf 25h,1
movf 24h,0 ; traer 24h s1 negado
andwf 25h,0 ; and entre 25h y 24h guardado en w
iorwf 23h,0 ;or entre w (and) y 24h and anterior. guardado en w
iorwf 27h,1 ;or entre w (acumulado de 2and) y la otra and. todo motor en el 27h
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MOTORI2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Sensor 0
MOVF PORTB,0 ;Mover puertoB a w
andlw 00000001; mascara para s0
movwf 20h ; guardar s0 en 20h
;Sensor4 negado y producto entre s0 y s4
MOVF PORTB,0 ;Mover puertoB a w
andlw 00010000; mascara para s4
movwf 21h ; guardar s4 en 21h
rrf 21h,1 ; rotar 4 veces
rrf 21h,1
rrf 21h,1
rrf 21h,1
comf 21h,1 ; complemento del rotado
movf 20h,0 ; traer s0
andwf 21h,1 ;and entre sensor4 negado(21h) y sensor0 (20h) guardado en 21h
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MOTORD1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;**********PRIMER PRODUCTO**********
;para seleccionar solo a S2
MOVF PORTB,0 ; Mover el pto B a W
ANDLW 00000100B ;mascara para cojer solo S2
MOVWF 2AH ; guardar en 2AH _00100
RRF 2AH,1
RRF 2AH,1 ;00001 S2
;Para seleccionar S3'
MOVF PORTB,0
ANDLW 00001000B ;mascara para cojer solo S3
MOVWF 2BH ; guardar en 2BH _01000
RRF 2BH,1
RRF 2BH,1
RRF 2BH,1 ; 00001
COMF 2BH,1 ; 11110 S3 negado
MOVF 2AH,0 ; mover S2 a W
ANDWF 2BH,1 ; and entre 2AH(S2) Y 2BH(S3') y se guarda en 2BH
;**********SEGUNDO PRODUCTO**********
;para seleccionar S1
MOVF PORTB,0 ; Mover el pto B a W
ANDLW 00000010B ;mascara para cojer solo s1
MOVWF 2CH ; guardar en 2CH _00010
RRF 2CH,1 ;00001 S1
;Para seleccionar S4'
MOVF PORTB,0
ANDLW 00010000B ;mascara para cojer solo S4
MOVWF 2DH ; guardar en 2DH _10000
RRF 2DH,1
RRF 2DH,1
RRF 2DH,1
RRF 2DH,1 ; 00001
COMF 2DH,1 ; 11110 S4 negado
MOVF 2CH,0 ; mover S1 a W
ANDWF 2DH,1 ; and entre 2CH(S1) Y 2DH(S4') y se guarda en 2DH
;**********TERCER PRODUCTO**********
;para seleccionar S0
MOVF PORTB,0 ; Mover el pto B a W
ANDLW 00000001B ;mascara para cojer solo S0
MOVWF 2EH ; guardar en 2EH _00001 S0
;Para seleccionar S1'
MOVF PORTB,0 ; Mover el pto B a W
ANDLW 00000010B ;mascara para cojer solo s1
MOVWF 2FH ; guardar en 2CH _00010
RRF 2FH,1 ;00001 S1
COMF 2FH,1 ; 11110 S1 negado
MOVF 2FH,0 ; mover S1 negado a W
ANDWF 2EH,1 ; and entre 2FH(S1') Y 2EH(S0) y se guarda en 2EH
MOVF 2BH,0 ; Mover el primer producto a W
IORWF 2DH,1 ;OR1 = OR entre produ 1 y produ 2 y se guarda en 2DH
MOVF 2DH,0; mover resultado de OR1 a W
IORWF 2EH,1 ; OR2 = OR entre OR1 y produ 3 y se guarda en 2EH
;++++++++++++++++++++++++++S E Ñ A L E2++++++++++++++++++++++++++++++++++++++
;Para seleccionar S0'
MOVF 2EH,0 ; S0 a W
MOVWF 28H ; guardar 00001 S0 en 28H
COMF 28H,1 ; 11110 S0 negado
;Para seleccionar S4
MOVF PORTB,0 ;mover de port B a W
ANDLW 00010000 ;mascara para cojer solo S$
MOVWF 29H ; llevar 10000 a 29H
RRF 29H,1
RRF 29H,1
RRF 29H,1
RRF 29H,1 ;00001 S4
MOVF 28H,0
ANDWF 29H,1 ;and entre 28H (S0') y 29H(S4) y se guarda en 29H
;++++++++++++++++++++++++++S E Ñ A L E3++++++++++++++++++++++++++++++++++++++
;Salida 1
bcf PORTA,0; Reset el bit 0 de la salida
BTFSC 27H,0; si el bit 0 del motor I1 es 0, salta
GOTO OFF; si el bit0 del motor I1 es 1 va a OFF
GOTO main
OFF:
BSF PORTA,0
GOTO main
;Salida 2
bcf PORTA,1; Reset el bit 0 de la salida
BTFSC 21H,0; si el bit 0 del motor I1 es 0, salta
GOTO OFF1; si el bit0 del motor I1 es 1 va a OFF
GOTO main
OFF1:
BSF PORTA,1
GOTO main
;SALIDA_E2:
BCF PORTA,2
BTFSC 2EH,0
GOTO OFF1
GOTO main
OFF2:
BSF PORTA,2
GOTO main
;SALIDA_E3:
BCF PORTA,3
BTFSC 29H,0
GOTO OFF1
GOTO main
OFF3:
BSF PORTA,3
GOTO main
END