CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Trouble with ext interrupt RB4-RB7

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sonny



Joined: 14 Sep 2015
Posts: 7

View user's profile Send private message

Trouble with ext interrupt RB4-RB7
PostPosted: Mon Sep 14, 2015 9:55 am     Reply with quote

Hello,

I'm new to the forum and to coding to. Anyway I'm struggling with the external interrupt change on value in RB5. I have a pic 1845J50, I made the circuit regulate an external voltage to a 3.3 V, I want to detect in RB5 when is changing from 0 to 3.3V and from 3.3 to 0. Basically changing from 1 to 0 or 0 to 1.

Please Help
TIA
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Sep 14, 2015 1:08 pm     Reply with quote

http://www.ccsinfo.com/forum/viewtopic.php?t=52922&highlight=intrb
http://www.ccsinfo.com/forum/viewtopic.php?t=52765&highlight=intrb
sonny



Joined: 14 Sep 2015
Posts: 7

View user's profile Send private message

PostPosted: Tue Sep 15, 2015 6:33 am     Reply with quote

Thanks so yesterday I got it to work but I can't monitor the H_TO_L and the L_TO_H on the same time in different pins. I want when the interrupt sees the voltage going low then the LED2 goes high, but if goes high led1 goes high. Can't see my error, please help.
This is what I have
Code:

#INT_RB
RB()
{
if(INPUT(PIN_B5) == 1)
   output_high(LED1);
else if (INPUT(PIN_B4) == 0)
   output_high(LED2);
break;
}

void main()
{
TRISB = 0b11110000;
PORTB = 0X00;
ext_int_edge(L_TO_H);
ext_int_edge(H_TO_L);
enable_interrupts(INT_RB);
enable_interrupts(GLOBAL);
clear_interrupt(INT_RB);
output_low(LED1);
output_low(LED2);
}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group