connecting gsm with arduino and dialling number from hex kepad

Discussion in 'Embedded Systems and Microcontrollers' started by bobparihar, Dec 26, 2014.

  1. bobparihar

    Thread Starter Member

    Jul 31, 2014
    93
    0
    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

    Code (Text):
    1.  
    2. #include <LiquidCrystal.h>
    3. LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
    4.  
    5. // incoming serial byte
    6. int number[10];
    7. int a, count=0;
    8. void setup()
    9. {
    10. lcd.begin(16, 2);
    11. for(int pin=3;pin<7;pin++)
    12. {
    13. pinMode(pin, INPUT);
    14. }
    15. attachInterrupt(0, key, RISING);
    16.  
    17. // start serial port at 9600 bps
    18. Serial.begin(9600);
    19. // wait for a while till the serial port is ready
    20. delay(100);
    21. // send the initial data once //
    22. }
    23.  
    24. void loop()
    25. {
    26. while(number[9]=='\0'); //wait till number array is full
    27.  
    28.  
    29.  
    30. lcd.clear();
    31. for(int i=0;i<10;i++)
    32. {
    33. lcd.print(number[I]);
    34. }
    35.  
    36. Serial.print("ATD");
    37.  
    38. delay(100);
    39. for(int i=0;i<10;i++)
    40. {
    41. Serial.print(number);
    42. delay(30);
    43. }
    44. serial.print(';');
    45.  
    46. delay(100);
    47. Serial.write(13);
    48. delay(100);
    49.  
    50. while(1);
    51. }
    52. void key()
    53. {
    54. a=PIND&0xF0;
    55. a=a>>4;
    56. number[count++]=a;
    57. lcd.print(a);
    58.  
    59.  
    60. }
    61.  
    Moderators note: Please use code tags for pieces of code
     
    Last edited: Dec 26, 2014
  2. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,388
    497
    Ok...
     
  3. bobparihar

    Thread Starter Member

    Jul 31, 2014
    93
    0
    What????
     
Loading...