Newbie question about push button interrupt code snippet

General discussion on mikroC.
Post Reply
Author
Message
crocu
Posts: 71
Joined: 18 Jun 2008 09:28
Location: France, Macon

Newbie question about push button interrupt code snippet

#1 Post by crocu » 29 Sep 2010 14:14

Hello,

I'm using a 18F2620 and would like to get 2 interrupts for 2 push buttons . ( BP is pulled-up high with resistance, the level gets down when BP is pressed )

I need one task to be done when BP1 (connected to RC6) is pressed, and do another task when BP2 ( connected to RC7) is pressed.

In fact, i would like to use interruptions to change my LCD screen display :

When BP1 is pressed -> my LCD display will show : ie " Message 1 "

if BP2 is pressed then LCD will display another message ie : " Message 2 "
if no BP are pressed ( normal condition ) , then it shows "Message 3"


Can someone put me on the way to declare and set interruption to have a task run when a BP is pressed ?
It is possible to have 2 differents interrupts : one for BP1 and another one for BP2 ?

A code example would be much appreciated :)

Many thanks for your help,

User avatar
tihomir.losic
mikroElektronika team
Posts: 2138
Joined: 02 Dec 2009 14:16
Location: Serbia
Contact:

Re: Newbie question about push button interrupt code snippet

#2 Post by tihomir.losic » 30 Sep 2010 09:25

Hello,

in attachment is our example for Buttons library.
Please, look at it in order to make your project successfully.

Also, I am suggesting you new version of mikroC PRO for PIC, which you can download from following link:
http://www.mikroe.com/esupport/index.ph ... &newsid=15

For any further assistance, feel free to contact me.

Best regards,

Losic Tihomir
Attachments
Button.rar
(30.44 KiB) Downloaded 289 times
mikroElektronika [Support team]

crocu
Posts: 71
Joined: 18 Jun 2008 09:28
Location: France, Macon

Re: Newbie question about push button interrupt code snippet

#3 Post by crocu » 30 Sep 2010 13:34

Thanks, but this example is not working with interrupts , isn't ?

User avatar
tihomir.losic
mikroElektronika team
Posts: 2138
Joined: 02 Dec 2009 14:16
Location: Serbia
Contact:

Re: Newbie question about push button interrupt code snippet

#4 Post by tihomir.losic » 30 Sep 2010 13:44

Hello,

yes you're right, and examples for Interrupt you can find at installation folder of compiler:
For example:
C:\Program Files\Mikroelektronika\mikroC PRO for PIC v4.1\Examples\Internal MCU modules\P18F8520

Best regards,

Losic Tihomir
mikroElektronika [Support team]

Post Reply

Return to “mikroC General”