LIST	p=16F648A		;tell assembler what chip we are using
include	"P16F648A.inc"		;include the defaults for the chip
	
__config 0x3D18			;a konfigurációs szó megadása
 
cblock	0x20			;start of general purpose registers
	count			;used in looping routines
	count1			;used in delay routine
	counta			;used in delay routine
	countb			;used in delay routine
	szorzo
endc
        
ORG	0x0000        
        
bsf	STATUS,	RP0	;az 1. adatmemória lap kiválasztása 
	
movlw	b'00000000'
movwf	TRISA
movwf	TRISB
		
bcf	STATUS,	RP0	;a 0. adatmemória lap kiválasztása


;***** PIN1 ON*****
movlw	d'16'
movwf	szorzo
ciklus1:
   call	Delay250
   decfsz	szorzo,1
goto ciklus1
movlw	b'11111110'
movwf	PORTB
call	Delay250
call	Delay250
movlw	b'11111111'
movwf	PORTB

;***** PIN2 ON*****
movlw	d'100'
movwf	szorzo
ciklus2:
   call	Delay250
   decfsz	szorzo,1
goto ciklus2
movlw	b'11111101'
movwf	PORTB
call	Delay250
call	Delay250
movlw	b'11111111'
movwf	PORTB

;***** PIN3 ON*****
movlw	d'20'
movwf	szorzo
ciklus3:
   call	Delay250
   decfsz	szorzo,1
goto ciklus3
movlw	b'11111011'
movwf	PORTB
call	Delay250
call	Delay250
movlw	b'11111111'
movwf	PORTB

;***** PIN4 ON*****
movlw	d'20'
movwf	szorzo
ciklus4:
   call	Delay250
   decfsz	szorzo,1
goto ciklus4
movlw	b'11110111'
movwf	PORTB
call	Delay250
call	Delay250
movlw	b'11111111'
movwf	PORTB

goto	vege

;Delay routine

Delay250	movlw	d'250'				;delay 25 mS
		goto	d0
Delay100	movlw	d'100'				;delay 100mS
		goto	d0
Delay50		movlw	d'50'			;delay 50mS
		goto	d0
Delay20		movlw	d'20'			;delay 20mS
		goto	d0
Delay5		movlw	0x05			;delay 5.000 ms (4 MHz clock)

d0		movwf	count1

d1		movlw	0xC7			;delay 1mS
		movwf	counta
		movlw	0x01
		movwf	countb
Delay_0
		decfsz	counta, f
		goto	$+2
		decfsz	countb, f
		goto	Delay_0

		decfsz	count1	,f
		goto	d1
		retlw	0x00

vege:
end