This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with Transfering SBUF value

Hi i m finding a problem in moving SBUF value to someother variable .
My Code is

serial () interrupt 4
{
    unsigned int ch[2];
    static int i=0;
    if (RI)  {
    if (i<2)
        {
        ch[i]=SBUF;
        i=i+1;
        }
    if (i==2){
    RI=0;
    Move(ch[0],ch[1]);
    RI = 0;
        i=0;
        SBUF='M';
        TI=1;

    }
    RI = 0;

  }
  if (TI)  {
    TI = 0;
  }
}and here is the Move Function
void Move(unsigned int j,unsigned int y)
{
    unsigned int c=0,d=0;

    SBUF=y;
    TI=1;
    c=j*12;
    c=c*(133/60);
    d=y*12;
    d=d*(133/60);
    c=c-86;
    d=d-79;
    SBUF=c;
    TI=1;
    }
I am passing SBUF values in to Move Function but they are not passed.
I tried to Simulate it even it is not simulating perfectly. the problem occurs when you pass SBUF value to another variable.
please help

0