;this is a simple source
;
;this little program toggles the PortA bit 3,
;Port B counts every change on bit RA.3
;



	list	p=PIC16C54, r=dec, s=off


	org	1ffh
	goto	start
	org	0



count1	=	0Bh			;this assigns the symbol to the register 

RA	=	5			;PortA is register 5
RB	=	6			;PortB is register 6



start	movlw	00000111b	
	tris	RA			;bit 0 to bit 2 are inputs

	movlw	0			;portb is output
	tris	RB

	clrf	RB,f			;clear PortB

main	movlw	00001000b
	xorwf	RA			;toggle bit 3 from PortA

	incf	RB,f			;increase PortB

	call	delay

	goto	main			;do the main loop




delay	movlw	20
	movwf	count1			;mov 20 to count1

:loop	decfsz	count1
	goto	:loop			;decrement count1 and jump to local symbol until
					;loop is > 0
	retlw	0
