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

C51: using

Hello,
I have Silabs 8051f120-DK.
I am making an interactive project between the MCU and a UI program written in VB.NET on a PC. The MCU receives a char and executes a procedure accordingly, i.e reading from ADC port.
Right now I am trying to debug a problem that I am having and I can't continue until I resolve this.
The code:
https://uploadfiles.io/cfde7 (Sorry about that, too many characters)

Notice what I am doing in main.

This is what the user see:
postimg.org/.../

Thanks, any enlightenment would be appreciated.

Parents
  • Google Drive?

    If you are waiting for a single character perhaps getchar() would be better? Or qualify scanf() == 1

    You could see what the other characters are that it is receiving, perhaps CR and LF?

    May be you could be more selective in when you print the prompt?

         printf("Enter 'r' to read volts:\n");
    
              argsread = scanf("%c",&key);    // user enters his key
    
    printf("\r\n%d %d\r\n", argsread, key); // report what you are seeing
    
              if ((argsread == 1) && (key == 'r'))
    ...
    

Reply
  • Google Drive?

    If you are waiting for a single character perhaps getchar() would be better? Or qualify scanf() == 1

    You could see what the other characters are that it is receiving, perhaps CR and LF?

    May be you could be more selective in when you print the prompt?

         printf("Enter 'r' to read volts:\n");
    
              argsread = scanf("%c",&key);    // user enters his key
    
    printf("\r\n%d %d\r\n", argsread, key); // report what you are seeing
    
              if ((argsread == 1) && (key == 'r'))
    ...
    

Children