; Simple program in assembler language for PIC processor (PIC12F509)
; from www.RoboHobby.com
; May be used for timer for Kite Aerial Photography (KAP)
; as a timer program.
; Very esy can be corrected for other PICs.
;
; URL: http://www.RoboHobby.com/genius_g-shot_d612.jsp
;
;

	list p=12F509
#include<p12F509.inc>
count1	EQU	0x08			;loop variable
count2	EQU	0x09			;loop variable
count3	EQU	0x0A			;loop variable
count4	EQU	0x0B			;loop variable
count5	EQU	0x0C			;loop variable
count6	EQU	0x0D			;loop variable
ledset1	EQU	0x11			;value 1 for output to the port
ledset2	EQU	0x12			;value 2 for output to the port
GPI2	EQU	0x15			;GPIO replacement for debug

;**********************************************************
;   The program		                                  *
;**********************************************************
INDF	EQU	00H				;
PCL		EQU	02H			;
STATUS	EQU	03H				;
GPIO	EQU	06H				;
TRISIO	EQU	85H				;
FSR		EQU	04H			;
		ORG	0x00			;
		clrf	GPIO			;
		movlw	b'000101000'		;
		bcf	STATUS,05		;
		tris	6			;
		movlw	0x17			;
		movwf	ledset1			;
		movlw	0x00			;
		movwf	ledset2			;
loop1	movf	ledset1,w			;
		movwf	GPIO			;
cycle1	movlw	0x02				;
		movwf	count1			;
cycle2	movlw	0xFF				;
		movwf	count2			;
cycle3	movlw	0xFF				;
		movwf	count3			;
cycle4	decfsz	count3,f			;
		goto	cycle4			;
		decfsz	count2			;
		goto	cycle3			;
		decfsz	count1			;
		goto	cycle2			;
loop2	movf	ledset2,w			;
		movwf	GPIO			;
cycle5	movlw	0x2F				;
		movwf	count4			;
cycle6	movlw	0xFF				;
		movwf	count5			;
cycle7	movlw	0xFF				;
		movwf	count6			;
cycle8	decfsz	count6,f			;
		goto	cycle8			;
		decfsz	count5			;
		goto	cycle7			;
		decfsz	count4			;
		goto	cycle6			;
		goto	loop1			;
		END				:
*************************************************
