View Single Post
  #5   Spotlight this post!  
Unread 15-04-2006, 21:10
intellec7's Avatar
intellec7 intellec7 is offline
108 programmer
AKA: Gustavo
FRC #0108 (SigmaC@ts)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2006
Location: Hollywood, Florida
Posts: 65
intellec7 is on a distinguished road
Send a message via AIM to intellec7 Send a message via MSN to intellec7
Re: Reading interupt pin as Standard IO

Quote:
Originally Posted by GW (Greg) Ross
Exactly. Try printing the on/off messages only when the pin state changes.
Alright, I did that, and I am pretty sure that was the lag I was experiencing, so now I can poll the input and if it is different from the last input I print something to the screen.

Now I'm trying to do it with interrupts, and I have the code in the ISR as so:
Code:
	else if (INTCONbits.RBIF && INTCONbits.RBIE){  /* Ints 3-6 (RB4, RB5, RB6, or RB7) changed. */
		int_byte = PORTB;          /* You must read or write to PORTB */
		INTCONbits.RBIF = 0;     /*     and clear the interrupt flag */
		if(accel_x){
			printf("High!n");
		}
		else if (accel_x ==0){
			printf("LOW!n");
		}
	}
But I never get any output from the program, telling me that the interrupt is never... interrupting. Right?

[EDIT]-Stupid mistake... I never enabled interrupts by setting bit : INTCONbits.RBIE :-p

Last edited by intellec7 : 16-04-2006 at 00:29.