1. You can now buy finished microcontroller project from us, Check out the Store for the complete list of projects.
  2. Need a custom project, Send us some details about your project. So that we can quote the price for it.

Error remove Heart Beating Signal System

Discussion in 'Project Doubts' started by Muhammad Fawad Khan, Jun 2, 2013.

  1. Muhammad Fawad Khan

    Muhammad Fawad Khan New Member

    Likes Received:
    0
    Trophy Points:
    1
    Making a heart beat system thorugh 8051 but there is a mistake i cant remove. it didn't show the output help me
    Code (Text):
    1.  
    2.  
    3. #include<AT89x51.h>
    4.  
    5. sbit RS=P1^0;
    6. sbit RW=P1^1;
    7. sbit E=P1^2;
    8. sbit BF=P1^7;
    9. unsigned char i;
    10. void delay(count)
    11. {
    12. int i;
    13. for( i=0;i<20*count;i++)
    14. {
    15. TL1=0xFD;
    16. TH1=0x4B;
    17. }
    18. }
    19.  
    20. int ready()
    21. {
    22. BF=1;
    23. RS=0;
    24. RW=1;
    25. while(BF==1)
    26. {
    27. E=0;
    28. E=1;
    29. }
    30. return;
    31. }
    32. int LCD_cmd(unsigned int m)
    33. {
    34. if (ready())
    35. {
    36. P2=m;
    37. RS=0;
    38. RW=0;
    39. E=0;
    40. E=1;
    41. }
    42. }
    43. int LCD_data(unsigned int n)
    44. {
    45. if (ready())
    46. {
    47. P2=n;
    48. RS=0;
    49. RW=0;
    50. E=0;
    51. E=1;
    52. }
    53. return 1;
    54. }
    55. void LCD_int()
    56. {
    57. LCD_cmd(0x38);
    58. LCD_cmd(0xE);
    59. LCD_cmd(0x01);
    60. LCD_cmd(0x06);
    61. }
    62. void main()  
    63. {
    64. unsigned char HB,count,x,y,units,tens;
    65. P1=0x00;
    66. T0=1;
    67. TMOD=0x01;
    68. TL0=0x00;
    69. TH0=0x00;
    70.  
    71. while (1)
    72. {
    73. TR0=1;          
    74. while(!TF0)
    75. {
    76. delay(1);
    77. count=TL0;
    78. HB=60*count;
    79.  
    80. u=hb%10;
    81. x=hb/10;
    82. t=x%10;
    83. h=hb/100;
    84.  
    85. t=t+48;
    86. u=u+48;
    87. h=h+48;
    88.  
    89. SHOW t,u,h on LCD
    90.  
    91. }
    92. TR0=0;
    93. TF0=0;
    94.     }
    95. }
    96.  
    Tags:
  2. Binu

    Binu Administrator

    Likes Received:
    135
    Trophy Points:
    63
    Whats that BF pin?
    you are not calling lcd intializing and display routines.
    Can you post the circuit diagram.
    Muhammad Fawad Khan likes this.
  3. Muhammad Fawad Khan

    Muhammad Fawad Khan New Member

    Likes Received:
    0
    Trophy Points:
    1
    There were some errors in the previous code but now it's error free..still Simulation is not workinG kindly guide me..Thanks in anticipation
    #include<AT89x51.h>

    sbit RS=P1^0;
    sbit RW=P1^1;
    sbit E=P1^2;
    sbit BF=P1^7;
    unsigned char i;
    void delay(count)
    {
    int i;
    for( i=0;i<20*count;i++)
    {
    TL1=0xFD;
    TH1=0x4B;
    }
    }

    int ready()
    {
    BF=1;
    RS=0;
    RW=1;
    while(BF==1)
    {
    E=0;
    E=1;
    }
    return;
    }
    int LCD_cmd(unsigned int m)
    {
    if (ready())
    {
    P2=m;
    RS=0;
    RW=0;
    E=0;
    E=1;
    }
    }
    int LCD_data(unsigned int n)
    {
    if (ready())
    {
    P2=n;
    RS=0;
    RW=0;
    E=0;
    E=1;
    }
    return 1;
    }
    void LCD_int()
    {
    LCD_cmd(0x38);
    LCD_cmd(0xE);
    LCD_cmd(0x01);
    LCD_cmd(0x06);
    }
    void LCD_show(unsigned char t,u,h)
    {
    if(ready())
    {


    delay(1);
    }
    }
    void main()
    {
    unsigned char HB,count,x,y,units,tens, t,u,h;
    P1=0x00;
    T0=1;
    TMOD=0x01;
    TL0=0x00;
    TH0=0x00;

    while (1)
    {
    TR0=1;
    while(!TF0)
    {
    delay(1);
    count=TL0;
    HB=60*count;

    u=HB%10;
    x=HB/10;
    t=x%10;
    h=HB/100;

    t=t+48;
    u=u+48;
    h=h+48;
    LCD_show(t);
    LCD_show(u);
    LCD_show(h);

    }
    TR0=0;
    TF0=0;
    }
    }
  4. Binu

    Binu Administrator

    Likes Received:
    135
    Trophy Points:
    63
    You still not calling the lcd initialize routine LCD_int() in the main()
  5. Muhammad Fawad Khan

    Muhammad Fawad Khan New Member

    Likes Received:
    0
    Trophy Points:
    1
    LCD_int() has been called before main n it show's zero error..problem is that simulation is not workinG properly..
  6. Binu

    Binu Administrator

    Likes Received:
    135
    Trophy Points:
    63
    Can you attach the simulation file.
  7. Muhammad Fawad Khan

    Muhammad Fawad Khan New Member

    Likes Received:
    0
    Trophy Points:
    1
    Program 89C51 to send the registration numbers (e.g. {1341,1326,1387}) of the group members serially at given baud rate of the group.
    Baud rate=19200
Loading...

Share This Page

Loading...