All pastes #917075 Raw Edit

Some Crap

public text v1 · immutable
#917075 ·published 2008-02-25 03:23 UTC
rendered paste body
	LIST	P=16F628, F=INHX8M
#include <p16f628.inc>

	__CONFIG  _INTRC_OSC_NOCLKOUT & _CP_OFF & _MCLRE_OFF & _WDT_OFF 

XTAL		EQU	4000000       ; internal crystal @ 4MHz
MODE	equ 0x20

;----- Structure of program memory -----

	ORG	0x00
	goto Main
	ORG 0x04
	goto buttoncheck

Main
	
	BSF	STATUS, RP0		;1us select bank 1
	movlw b'00000001'	;1us make rb0 input
	movwf TRISB			;1us send info to TRISB to make rb0 input
	BCF	STATUS, RP0		;1us select bank 0
	banksel OPTION_REG  
	BCF OPTION_REG,INTEDG 	;Interrupt occurs at faling edge
	BSF OPTION_REG,NOT_RBPU ; Disable internal pull-up resistors
	BCF STATUS, RP0		;1us select bank 0
	CLRF PORTA			;1us clear PORTA
	CLRF PORTB			;1us clear PORTB
	BSF INTCON,INTE		;1us interrupt on RB0 enabled
	BSF INTCON,GIE		;1us all interrupts enabled
	movlw 1
	movwf MODE
	BSF PORTB,7


Loop
		goto Loop 		;Main loop

buttoncheck
	
	BCF INTCON,INTF		;1us Clear flag bit just in case (paranoya)
	incf MODE, F
	movf 1, W
	CPFSGT COUNT ; if F is greater than W skip the next line
	goto Mode1
	retfie

Ledon
	BSF PORTB,7			; If false switch on led
	retfie
	
	end