initially "hello" message displays at 0x80. if i press a respective key "hello" should disappears another msg "wait" shoud display at 0x80. then if i press another key "wait" should disappear again "hello" should come. how could be written in interrupt function
I can see one problem straight away - you are held in the ISR until RD0 is released. That will block any other interrupts from being serviced. You also call another function 'coin()' from inside the ISR and it contains a delay. Best to set a variable when the ISR is entered, clear the interrupt then leave. You can check that variable in the main() part of your code without disrupting the interrupts. At the moment your timer may be very inaccurate and inconsistent depending on the state of RD0.
sir please explain how to set a variable in interrupt. ex"coin"has to display has to display when i give input to RD0. if i release RD0 old msg previous "welcome" has to show. that is i have to clear the interrupt.
Why do you want to use Timer0 ? See my attached codes. One displays "Welcome" message. The rev1 version displays two messages "Welcome" and "Insert Coin" when button is pressed. Your circuit should be as shown in the image. I have also included Proteus 8.2 SP2 format file. If you want to use interrupt to detect button press then you have to use RB0/INT0 pin. If you can use RB0 pin for button then I will give you a code which uses it to detect button press using INT0 interrupt. I have used 4 bit LCD code. RW pin of LCD can be connected to ground or if you have it connected to RC1 then it is also ok because in code I have set 0 to RC1. D0 to D3 pins of LCD can be left floating.
I have used MPLAB 8.92 and Hi-Tech PICC 9.83. I have set config bits in IDE. If you want MPLAB X code then let me know and I will make MPLAB X version of project.
I have compiled the code for 4 MHz XT Oscillator. MCLR is enabled and pulled high using a 10k resistor, Circuit doesn't show crystal and associated 27pf capacitors. You have to add them.
broken link removed
- - - Updated - - -
Edit:
Try the rev2 file. See simulation video (.avi) file inside. It works as you want but the code execution will be blocked when it encounters the while(condition) loops. A better code can be written using INT0 interrupt.
- - - Updated - - -
This is a version which uses INT0 pin for the button. It doesn't have any blocking code.