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

UART

Ive tried to move data from Sbuf to Acc.....
Ive tried using this code... whil;e debuggin the code ive used the serial window to pass data....
my main aim is to compare data that i recieve from the Rxd pin with memory

#include<stdio.h>
#include<reg51f.h>

unsigned char c ;

char getchar()
{ while( RI != 0 ) { c = SBUF; RI = 0; } return(c);
}

void main()
{ unsigned char b; b = getchar(); //printf("%c",&b );

B = b;
}

ive also tried using _getkey().. and getchar directly.

Parents
  • That code doesn't actually seem to do anything at all!

    What do you think that it should do?
    What does it actually do?
    What study, tests, debugging, etc have you done to account for the difference?
    Have you tried it in the Simulator?

    Have you studied the Keil documention and examples?

    The code is full of commented-out stuff, and stuff which has no fucntion. You need to cut it down to the smallest, complete, compilable example that illustrates you problem.

Reply
  • That code doesn't actually seem to do anything at all!

    What do you think that it should do?
    What does it actually do?
    What study, tests, debugging, etc have you done to account for the difference?
    Have you tried it in the Simulator?

    Have you studied the Keil documention and examples?

    The code is full of commented-out stuff, and stuff which has no fucntion. You need to cut it down to the smallest, complete, compilable example that illustrates you problem.

Children
  • 4m whatever information you have provided here,
    I think u don hav to check for RI in main func
    call your func directly without RI,which is recept();
    n switch func is in your hands based on the input.......

    Because RI occurs only when your character is received on Rx pin.
    Again after receiving your character u are asking another through getkey()....
    so,please check it once.