Knight rider light with Pic16F84A


knight rider KITT circuit schematic with led and pic16f84,led chaser

Knight rider light schematic

This programm use the internal eeprom to store the data. The content of eeprom memory (address 2100 to 210D) it is diplayed on portb, one adress at a time. Simply modify the eeprom content and you can have other light effect.

Here you can download the .asm and .hex code


Source code file for knight rider light
;=======Knight.ASM=================================19/03/03==
;     internal clock
;     standard crystal 4MHz, 1us/instruction
;     http://www.module.ro
;------------------------------------------------------------
;     configure programmer
	list	p=16f84A;f=inhx8m
	#INCLUDE P16F84.INC
_CP_OFF	equ	H'3FFF'	      ;code protect off
_PwRTE_ON	equ	H'3FFF' 		;Power on timer on
_wDT_OFF	equ	H'3FFB'		;watch dog timer off
_XT_OSC	equ	H'3FFD'		;crystal oscillator
	__CONFIG       _CP_OFF & _PwRTE_ON & _wDT_OFF & _XT_OSC
;------------------------------------------------------------
;      cpu init
count1	equ	0C
count2	equ	0D
count3	equ	0E
count4	equ	0F
;------------------------------------------------------------
;------------------------------------------------------------
	org	0x00
	goto	init
	org	0x04
;*****************************************************************
init   
	bsf 	STATUS,RP0	; SET BANK = 1.
	movlw	B'00000000'	; SET PORTB TO ALL OUTPUT.
	movwf	TRISB
	bcf 	STATUS,RP0	; SET BANK = 0.
;*****************************************************************
start	movlw	0x0E	  
	movwf	count4
	movlw	B'00000000' 
	movwf	EEADR
urma	call	EEPROMREAD
	movwf	PORTB
	call	stepp
	clrf	PORTB 
	incf	EEADR,F 
	decfsz  count4,f
	goto	urma
	goto	start
;******************************************************************
EEPROMREAD	
	BSF	STATUS,5	; SET TO BANK 1
	BSF	EECON1,00	; INITIATES AN EEPROM READ
	BCF	STATUS,5	; SET TO BANK 0
	MOVF	EEDATA,W	; TRANSFER EEDATA DIN EEPROM IN W
	RETURN
;*****************************************************************
stepp	movlw	0x02	  
	movwf   count3
pas3	movlw	0xff	  
	movwf   count2
pas2	movlw	0xff	  
	movwf   count1
pas1	decfsz  count1,f	; decrement and skip next line if zero
	goto	pas1		; if not zero
	decfsz  count2,f
	goto	pas2	
	decfsz  count3,f
	goto	pas3
	retlw	00
;*****************************************************************
	ORG	0x2100
	de	0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80
	de	0x40,0x20,0x10,0x08,0x04,0x02
	end
;============================================================

Back to my home page
Last updated March, 2003
© Copyright 2003 Bergthaller Iulian-Alexandru