Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7953143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:04:29+00:00 2026-06-04T03:04:29+00:00

My Program would store the IR signal as ‘0’ or ‘1’ to the xdata

  • 0

My Program would store the IR signal as ‘0’ or ‘1’ to the xdata 1kByte SRAM of DS89C450 and then display it on my MTK.

However, the data displayed only display character ‘F’ no matter what button i pressed on the IR remote control.(I have a CASE function that converts data into ASCII code, for this case ‘F’ = 0x0F).
http://img193.imageshack.us/img193/1410/66647882.png

Firstly: When IR Signal is received, the falling edge interrupt will trigger and store what every data is from the pin to x[i] every 38 us and Data_Ready is set to 1.

/******************************FALLING EDGE INTERRUPT*************************/
void ex_int0(void)interrupt 0     
{
       unsigned char p;
       unsigned int u;
       unsigned int i;
       EA=0;

       for(i=0;i<500;i++)       //Loop for 500 bytes
       {
          for(u=0;u<8;u++)      //Bit Shift Loop
          { 
             timer0();          //Call timer0 function(38us)    
             x[i] = x[i] << 1;  //Left Bit Shift by 1
             p = Tsignal;       //Store Tsignal to Buffer p
             x[i] |= p;         //OR Masking of p with x[i]

          } 
       }

   EA=1;
   IE1 = 0;              
   Data_Ready = 1;             //Set Data_Ready = 1

 }//end 

Next, The store data will be convert to ASCII code byte by byte. (eg. 1111 1111 = FF)

/******************************DISPLAY_BYTE***********************************/
void Display_Byte()
{
   unsigned char Data_LK;
   unsigned char MSB;
   unsigned char LSB;
   unsigned int v;  
   TR1=1;                          //Enable Serial Port                                              
   for(v=0;v<500;v++)
   {    
      Data_LK = x[v];                      //Store x[v] in Data_LK
      MSB = Data_LK >> 4;                  //Shift Right Bits by 4      
      MSB &= 0x0F;                         //Mask bits of MSB
      MSB = lookuptable(MSB);              //Send MSB to lookuptable function                           
      SerialTx(MSB);                       //Send Converted Data to transmit

      LSB = x[v];                          //Store x[v] in LSB
      LSB &= 0x0F;                         //Mask bits of LSB
      LSB = lookuptable(LSB);              //Send LSB to lookuptable 
      SerialTx(LSB);                       //Send converted data to transmit
   }

   Data_Ready = 0;                         //Set Data_Ready to 0
   TR1 = 0;                                //Turn off Serial Port   
}

This is the lookuptable:

/***********************LOOKUP TABLE*************************************/
unsigned char lookuptable(unsigned char t)
{
  switch(t)
  {
     case 0x00 : return '0';
     break;
     case 0x01 : return '1';
     break;
     case 0x02 : return '2';
     break;
     case 0x03 : return '3';
     break;
     case 0x04 : return '4';
     break;
     case 0x05 : return '5';
     break;
     case 0x06 : return '6';
     break;
     case 0x07 : return '7';
     break;
     case 0x08 : return '8';
     break;
     case 0x09 : return '9';
     break;
     case 0x0A : return 'A';
     break;
     case 0x0B : return 'B';
     break;
     case 0x0C : return 'C';
     break;
     case 0x0D : return 'D';
     break;
     case 0x0E : return 'E';
     break;
     case 0x0F : return 'F';
     break;
     default: break;
 }// end switch
}// end function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:04:31+00:00Added an answer on June 4, 2026 at 3:04 am

    At least one of the errors is that you are not doing anything with the result of the calls to lookuptable() so you are transmitting the unconverted MSB and LSB values.

    You probably meant to do something like this:

    MSB = lookuptable(MSB);
    SerialTx(MSB);
    /* ... etc ... */
    LSB = lookuptable(LSB);
    SerialTx(LSB);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I wanted to write a program that would export calendar data so that
I would like to store some Application-Related Metadata for Files, and NTFS Alternate Data
I have a single user java program that I would like to have store
I like to store my data after a longish python program as dictionaries in
I would like to be able to use TValue to store Data in a
I've read upstream program from here ... http://xunitpatterns.com/Back%20Door%20Manipulation.html If the data store is external
I would like to store some XML program preferences as a resource in a
For some small programs in Python, I would like to set, store and retrieve
Any suggestions on why a VB6 program would be slower when compiled than when
I'm developing a program that would require huge amount of memory, and I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.