; TUTA3.ASM  27SEP07

;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 
; Configuration data 
; PICmicro MCU type: 16F1937 
; Oscillator: Oscillator: XTAL mode
; LCD display: off 
; 7-segment display: off 
; Version 3 board settings: J14 links: Digital 
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;
; 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'	


; using names to ease writing of TUTA2
				

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	movlw   	b'00000000'	; move value 0 to W
	movwf	PORTB		; load PortB with contents of W 
	movlw	0x0		; delay	
	movwf COUNT;		; 
Delay_0
 	decfsz	COUNT, f		;
 	goto	Delay_0		;

	movlw   	b'00000001'	; move value 0 to W
	movwf	PORTB		; load PortB with contents of W 
	movlw	0x0	
	movwf COUNT;
Delay_1
 	decfsz	COUNT, f
 	goto	Delay_1

	movlw   	b'00000011'	;move value 0 to W
	movwf	PORTB		;load PortB with contents of W 
	movlw	0x0	
	movwf COUNT;
Delay_2
 	decfsz	COUNT, f
 	goto	Delay_2

	movlw   	b'00000111'	; move value 0 to W
	movwf	PORTB		; load PortB with contents of W 
	movlw	0x0	
	movwf COUNT;
Delay_3
 	decfsz	COUNT, f
 	goto	Delay_3

	movlw   	b'00001111'	;move value 0 to W
	movwf	PORTB		; load PortB with contents of W 
	movwf COUNT;
Delay_4
 	decfsz	COUNT, f
 	goto	Delay_4

	movlw   	b'00011111'	; move value 0 to W
	movwf	PORTB		; load PortB with contents of W 
	movlw	0x0	
	movwf COUNT;
Delay_5
 	decfsz	COUNT, f
 	goto	Delay_5

	movlw   	b'00111111'	; move value 0 to W
	movwf	PORTB		; load PortB with contents of W 
	movlw	0x0	
	movwf COUNT;
Delay_6
 	decfsz	COUNT, f
 	goto	Delay_6

	movlw   	b'01111111'	; move value 0 to W
	movwf	PORTB		;  load PortB with contents of W 
	movlw	0x0	
	movwf COUNT;
Delay_7
 	decfsz	COUNT, f
 	goto	Delay_7

	movlw   	b'11111111'	; move value 0 to W
	movwf	PORTB		; load PortB with contents of W 
	movlw	0x0		;
	movwf COUNT;		;
Delay_8				
 	decfsz	COUNT, f
 	goto	Delay_8

	CLRF PORTB

	goto	LOOPIT		; goto the start do it all again

	END			; final statement
