; TUTA3.ASM  

;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 
; Configuration data 
; PICmicro MCU type: 16F1937 
; Oscillator: internal Oscillator 
; LCD display: off 
; 7-segment display: off 
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;
; The following lines embed configuration data into the PICmicro
	LIST P=16F1937
  __CONFIG H'8007', H'FE4'  ; Internal osc mode
   __CONFIG H'8008', H'1EFF' 
 #DEFINE   PAGE0   MOVLB 0
  #DEFINE   PAGE1   MOVLB 1
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 
COUNT	EQU	H'20'	
PORTB	EQU	H'0D'		; name program location 13 as PORTB
				
	ORG	0		; Reset vector
	GOTO	5		; Goto start of program
	ORG	4		; Interrupt vector
	GOTO	5		; Goto start of program
	ORG	5		; Start of program memory
	CLRF	PORTB		; clear Port B data pins
	PAGE1			; Page 1
	MOVLW	0x07
	MOVWF	H'99'		; Setup the OSCCON register to set int osc at 31KHz
	CLRF	H'9E'		; Setup the ADCON1 register
	CLRF	PORTB		; set all Port B as output via Page 1
	PAGE0			; Page 0
				
LOOPIT	BSF	PORTB,0		; set Port B pin 0 to logic 1
	
	movlw	0x0	
	movwf COUNT;
Delay_0
 	decfsz	COUNT, f
 	goto	Delay_0


	BSF	PORTB,1		; set Port B pin 1 to logic 1
		
	movlw	0x0	
	movwf COUNT;
Delay_1
 	decfsz	COUNT, f
 	goto	Delay_1

	BSF	PORTB,2		; set Port B pin 2 to logic 1

	movlw	0x0	
	movwf COUNT;
Delay_2
 	decfsz	COUNT, f
 	goto	Delay_2

	BSF	PORTB,3		; set Port B pin 3 to logic 1

    movlw	0x0	
	movwf COUNT;
Delay_3
 	decfsz	COUNT, f
 	goto	Delay_3

	BSF	PORTB,4		; set Port B pin 4 to logic 1

	movlw	0x0	
	movwf COUNT;
Delay_4
 	decfsz	COUNT, f
 	goto	Delay_4

	BSF	PORTB,5		; set Port B pin 5 to logic 1

	movlw	0x0	
	movwf COUNT;
Delay_5
 	decfsz	COUNT, f
 	goto	Delay_5

	BSF	PORTB,6		; set Port B pin 6 to logic 1

	movlw	0x0	
	movwf COUNT;
Delay_6
 	decfsz	COUNT, f
 	goto	Delay_6
	CLRF	PORTB
	BSF	PORTB,7		; set Port B pin 7 to logic 1

	movlw	0x0	
	movwf COUNT;
Delay_7
 	decfsz	COUNT, f
 	goto	Delay_7	

	CLRF	PORTB		; clear all PORTB pins

	movlw	0x0	
	movwf COUNT;
Delay_8
 	decfsz	COUNT, f
 	goto	Delay_8	

	GOTO	LOOPIT		; goto address LOOPIT


	END			; final statement
