Bob Parihar
Member
i want to dial a number from hex keypad to call..
iam using interrupt method
hex keypad uses 74c922 keypad decoder ic
DA pin of 74c922 IC is connected to External interrupt pin 2
whenver the button is pressed an interrupt is invoked and the corresponding 4bit number reads by MCU at pin 4,5,6 and 7
iam using interrupt method
hex keypad uses 74c922 keypad decoder ic
DA pin of 74c922 IC is connected to External interrupt pin 2
whenver the button is pressed an interrupt is invoked and the corresponding 4bit number reads by MCU at pin 4,5,6 and 7
C:
#include <LiquidCrystal.h>
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
// incoming serial byte
int number[10];
int a, count=0;
void setup()
{
lcd.begin(16, 2);
for(int pin=3;pin<7;pin++)
{
pinMode(pin, INPUT);
}
attachInterrupt(0, key, RISING);
// start serial port at 9600 bps
Serial.begin(9600);
// wait for a while till the serial port is ready
delay(100);
// send the initial data once //
}
void loop()
{
while(number[9]=='\0'); //wait till number array is full
lcd.clear();
for(int i=0;i<10;i++)
{
lcd.print(number[I]);
}
Serial.print("ATD");
delay(100);
for(int i=0;i<10;i++)
{
Serial.print(number);
delay(30);
}
serial.print(';');
delay(100);
Serial.write(13);
delay(100);
while(1);
}
void key()
{
a=PIND&0xF0;
a=a>>4;
number[count++]=a;
lcd.print(a);
}
Last edited by a moderator: