Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

SETUP AN INTERRUPT IN 16f690

Status
Not open for further replies.
You can't have a goto inter in your interrupt. It will never get out of the interrupt code.

Your interrupt should check the relevent bits and execute the appropriate code.
Something like this,
Code:
inter:
		movwf	temp
		swapf	STATUS,w
		clrf	STATUS
		movwf	temp_s
		btfss	INTCON,RBIF	;is it Port B change interrupt
		goto	NotPortB	;no, go check other interrupts
		movfw	PORTB		;read port B to clear change condition
		bcf	INTCON,RBIF	;Yes so clear the interrupt flag

		;put code here for RB4 change

NotPortB	btfss	INTCON,INTF	;is it INT0 interrupt
		goto	NotIntF		;no
		bcf	INTCON,INTF	;Yes so clear the interrupt flag

		;Put code here for RB0 rising edge
		
NotIntF
		swapf	temp_s,w
		movwf	STATUS
		swapf	temp,w
		retfie

You can add as many other checks as you have interrupts enabled. So, if you want a timer0 interrupt you would check INTCON,T0IF and branch as necessary.

Mike.
 
I used 220 ohm resistor as pull down and the codes work well but now it is melfunctioning, is it possible that the PIC is damaged because of very low (220 ohm) pull down resistance ? Can I verfy that ? Please answer me I'm worried:(:confused:
 
Even if you set the pin to output you wouldn't damage it (5/220=22mA). With it set to input it is impossible to damage it with a pullup/down unless you are using a supply that is too high (>5.5V).

Mike.
 
O.K. again it is working right but, by mistake I shorted Vss and Vdd once and then the busy LED on PIC kit 2 start blinking and I have to turn off the PC and then the PIC again start melfunctioning but, after reloading the codes it works fine, Can shrting Vss and Vdd damage PIC kit or PIC ?
 
You probably crashed the Pickit2. When this happens, you can rectify it by unplugging the Pickit2 from the USB (and any other source of power) wait a few seconds and then plug it back in. Next, in MPLAB, deselect PicKit2 by selecting none and then reselect it.

Mike.
 
Mine MPLAB shows (in programmer selection) pic kit 2 in gray (not available) thiugh transfering hex file still do work on kit, what should I do to make pic kit 2 available in programmer list ?
 
Last edited:
The Pickit2 doesn't support the 16F628, only the 16F628A. How did you get it working previously?

Mike.
 
previously I was working on 16f690 demo board supplied with kit, so I thought it was working and now it stops but, if the kit does'nt support 16f628 then how can I be able to programme it ? That's what I have done successfuly :confused:
Edit: Though I got what do you mean by not supported but still curious that why so ?
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top