;  Microcontroller model: PIC12F629
; Clock frequency: 4.0 MHz
;
;       The address of 'canal0' (bit) (global) is 0x5,0
;       The address of 'canal1' (bit) (global) is 0x5,1
;       The address of 'canal2' (bit) (global) is 0x5,2
;       The address of 'canal3' (bit) (global) is 0x5,4
;       The address of 'pulsador' (bit) (global) is 0x5,5
;       The address of 'tiempo' (word) (global) is 0x2C
	tiempo EQU 0x2C
; Begin
	R0L EQU 0x20
	R0H EQU 0x21
	R1L EQU 0x22
	R1H EQU 0x23
	R2L EQU 0x24
	R2H EQU 0x25
	R3L EQU 0x26
	R3H EQU 0x27
	R4L EQU 0x28
	R4H EQU 0x29
	R5L EQU 0x2A
	R5H EQU 0x2B
	ORG 0x0000
	BCF PCLATH,3
	BCF PCLATH,4
	GOTO L0002
	ORG 0x0004
	RETFIE
L0002:
; 1: Symbol canal0 = GPIO.0
; 2: Symbol canal1 = GPIO.1
; 3: Symbol canal2 = GPIO.2
; 4: Symbol canal3 = GPIO.4
; 5: Symbol pulsador = GPIO.5
; 6: 
; 7: AllDigital
	MOVLW 0x07
	MOVWF 0x19
; 8: TRISIO = %100000 'GPIO: 0 = salidas
	BSF STATUS,RP0
	MOVLW 0x20
	MOVWF 0x05
; 9: 
; 10: Dim tiempo As Word
	BCF STATUS,RP0
	CLRF 0x2C
	CLRF 0x2D
; 11: tiempo = 130
	MOVLW 0x82
	MOVWF 0x2C
	CLRF 0x2D
; 12: loop:
L0001:
; 13: 'Bucle principal
; 14: 	canal0 = 1
	BSF 0x05,0
; 15: 	canal1 = 0
	BCF 0x05,1
; 16: 	canal2 = 0
	BCF 0x05,2
; 17: 	canal3 = 1
	BSF 0x05,4
; 18: 	WaitMs tiempo
	MOVF 0x2C,W
	MOVWF R0L
	MOVF 0x2D,W
	MOVWF R0H
	CALL W001
; 19: 
; 20: 	canal0 = 1
	BSF 0x05,0
; 21: 	canal1 = 1
	BSF 0x05,1
; 22: 	canal2 = 0
	BCF 0x05,2
; 23: 	canal3 = 0
	BCF 0x05,4
; 24: 	WaitMs tiempo
	MOVF 0x2C,W
	MOVWF R0L
	MOVF 0x2D,W
	MOVWF R0H
	CALL W001
; 25: 
; 26: 	canal0 = 0
	BCF 0x05,0
; 27: 	canal1 = 1
	BSF 0x05,1
; 28: 	canal2 = 1
	BSF 0x05,2
; 29: 	canal3 = 0
	BCF 0x05,4
; 30: 	WaitMs tiempo
	MOVF 0x2C,W
	MOVWF R0L
	MOVF 0x2D,W
	MOVWF R0H
	CALL W001
; 31: 
; 32: 	canal0 = 0
	BCF 0x05,0
; 33: 	canal1 = 0
	BCF 0x05,1
; 34: 	canal2 = 1
	BSF 0x05,2
; 35: 	canal3 = 1
	BSF 0x05,4
; 36: 	WaitMs tiempo
	MOVF 0x2C,W
	MOVWF R0L
	MOVF 0x2D,W
	MOVWF R0H
	CALL W001
; 37: 
; 38: Goto loop
	GOTO L0001
; End of program
L0003:	GOTO L0003
; Waitms Routine
W001:	MOVF R0L,F
	BTFSC STATUS,Z
	GOTO W002
	CALL W003
	DECF R0L,F
	NOP
	NOP
	NOP
	NOP
	NOP
	GOTO W001
W002:	MOVF R0H,F
	BTFSC STATUS,Z
	RETURN
	CALL W003
	DECF R0H,F
	DECF R0L,F
	GOTO W001
W003:	MOVLW 0x0C
	MOVWF R2H
W004:	DECFSZ R2H,F
	GOTO W004
	NOP
	NOP
	MOVLW 0x12
	MOVWF R1L
W005:	DECFSZ R1L,F
	GOTO W006
	CALL W007
	CALL W007
	NOP
	NOP
	RETURN
W006:	CALL W007
	GOTO W005
W007:	MOVLW 0x0D
	MOVWF R2L
W008:	DECFSZ R2L,F
	GOTO W008
	NOP
	RETURN
; End of listing
	END
