April 14, 2005

new house

billy and i signed paperwork on a house yesterday. the new ranch is on ne russell right off mlk. best of all, it's totally walking distance to the queen of sheba.

Posted by drewish at 12:09 PM | Comments (0) | TrackBack

April 11, 2005

yapp (yet another pov project)

Lady Ada, patron saint of all things POV and all things housed in an Altoid's tin, has a new POV project up based around the Amtel ATtiny2313. Best of all she shows how to program the controller via parallel port so you don't need to buy yet another programmer. There are free plans or she'll sell you a kit.

Posted by drewish at 07:25 PM | Comments (0) | TrackBack

April 06, 2005

using portchange interrupts on the PIC 16F630

Microchip's 16F630 is a pretty cool little chip. One of its features is to interrupt when the input on a pin changes. I had a bit of a time figuring out how to do it so I'll put this up to save someone else the trouble.

The short version is: Enable interrupts with INTCON's GIE, PEIE and RAIE bits. Set bits in TRISA and IOCA that correspond to the pins to watch. In the interrupt handler read PORTA then clear INTCON's RAIF bit.

	title "InputInterrupt"
	LIST	P=16F630, F=INHX8M
#include <p16f630.inc>
	__CONFIG  _INTRC_OSC_NOCLKOUT & _CP_OFF & _MCLRE_OFF & _WDT_OFF 
XTAL		EQU	4000000       ; internal crystal @ 4MHz

; backup spots for registers during interrupt handling
w_bak		equ	0x20
status_bak	equ	0x21
fsr_bak 	equ	0x22

; startup (at fixed address 0x0)
	org 0x0
	goto Main
; interrupt handler (at fixed address 0x4)
	org 0x4
IntHandle
	; save registers
	movwf	w_bak
	swapf	STATUS, W
	clrf	STATUS
	movwf	status_bak
	movfw	FSR
	movwf	fsr_bak
	
	; jumpt to proper handler
	btfsc	INTCON, RAIF	; check for port change
	goto	PortHandler

IntHandle_Return
	; restore all the backed up registers
	movfw	fsr_bak
	movwf	FSR
	swapf	status_bak, W
	movwf	STATUS
	swapf	w_bak, F
	swapf	w_bak, W
	retfie			; return from interrupt

PortHandler
	; To clear the interrupt you have to do two things in order:
	; * read the port
	; * clear the interrupt flag

;DO STUFF HERE
	; for testing copy inputs from port A to port C
	movfw	PORTA
	movwf	PORTC
	
	; clear portchange interrupt flag
	bcf	INTCON, RAIF

	goto	IntHandle_Return
;End PortHandler

Main
	; enable interupts
	bsf	INTCON,	GIE	; enable global interrupts
	bsf	INTCON,	PEIE	; enable peripheral interrupts
	bsf	INTCON, RAIE	; enable port change interrupts

	; clear the port
	clrf	PORTA

	; make the changes to Bank 1 all at once
	bsf	STATUS,	RP0
	; Port A 
	movlw	B'00111111'	; all 6 pins will be inputs
	movwf	TRISA		; set pin as input
	movwf	IOCA		; interupt on change
	; finished with Bank 1
	bcf   	STATUS,	RP0

MainLoop
	; kill time here waiting for an interupt
	goto	MainLoop

	end
Posted by drewish at 04:42 PM | Comments (0) | TrackBack

April 05, 2005

a new kind of bad

nick, mad that i dissed some movie about new york (and there fore perfect), sent me this link. the question i put to you is: what's the worst part about it?

his hair? the bandwagon patriotism? the blatant 9/11 imagery? that they let him into a school? the guns and roses outtakes strung into a song? angels? shots pulling back to reveal babies behind tombstones? that they bought out the flag store to make this video? that they let him near children?

Posted by drewish at 01:00 PM | Comments (3) | TrackBack
Creative Commons License xml feed