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

How to make communication between c51 and vc++

Hi ,
i am developing a configuration control GUI using VC++. And the microcontroller programs written in keil , my work is to call the keil programs from GUI, and send the user selected intial values in GUI to keil , and get acknowledgement from keil to user, then user can send data to keil , the which microcontrooler has to send to receiver microcontroller, and on other hand microcontrooler will receive data and that data will send to microcontroller program via serial port, than that data which microcontroller get should send to GUI. my work is to make communication between keil and vc++, nothing to do with keil program communication with microcontroller, if any one have any idea please guide me.
Thanking you
with regards
sheshidar patnam

  • An RS232 link is probably the most obvious.

    What other interfaces do you have available?

    It may help if you clarify your terminology:

    VC++ is a tool for creating application to run on a PC;

    Keil C51 is a tool for creating application to run on an 8051 microcontroller;

    There is no communication between VC++ and Keil C51 - the communicaion is between the PC application (created using VC++) and the 8051 application (created using Keil C51).

    If you do use RS232, the PC application simply needs to handle data sent to and received from a COM: port - it does not need to know whether there's an 8051, another PC, or whatever else connected to that COM: port;

    Similarly, the 8051 simply needs to handle data sent to and received from its UART - it does not need to know whether there's another 8051, a PC, or whatever else connected to that UART!

  • Thx very much for ur message,
    We are using USB2.0 as interface between pc and µc. As you said there is no communication between VC and keil.And we have to load keil program in µc, but in this we cannot make changes in data , intial values , changing settings of µc programs dynamically at run rime. But i am developing a GUI to overcome this problem, so in this user can make settings to µc programs dynamically using GUI, in this i have to make communication between VC and keil. Is there no possibility to communicate two PC applications?, which are runnibg in same pc.

  • "We are using USB2.0 as interface between pc and µc"

    In that case, the PC application just needss to use the API provided by the USB drivers, and the microcontroller application needs to do whatever the datasheet tells you to access the USB interface.

  • "in this we cannot make changes in data , intial values , changing settings of µc programs dynamically at run rime."

    You could have part of your uC application receive this data over the USB interface at runtime.

    Alternatively, have VC generate a 'C' source file that contains these settings, and include this in your uVision project.

  • Thx for your message,
    but sorry to say that i didn't understand what u mean by.
    Thanking you.

  • Think about a standard modem.

    When you buy it from the shop, it comes with all its parameters set to default values.
    These are the values that came from its source code; if the manufacturer wanted to change these, he would have to change the source code & re-compile it.

    When you connect the modem to your PC, you can change settings by issuing AT commands; eg, you can turn Auto-Answer on or off; set the baud rate; etc, etc,...
    The microcontroller within the modem has some software to receive & interpret these commands, and adjust its data variables accordingly.

    You could implement something similar, allowing your embedded code to receive data at run time.

    Alternatively, if you only want to make changes at compile time, you could have VC++ generate the 'C' source file that contains these settings; eg, in VC++

      :
      :
      fprintf( c_file, "char a = %d;", value_for_a );
      fprintf( c_file, "char b = %d;", value_for_b );
      fprintf( c_file, "char c = %d;", value_for_c );
      fprintf( c_file, "char d = %d;", value_for_d );
      :
      :
    would create something like:
      :
      :
      char a = 1;
      char b = 2;
      char c = 3;
      char d = 99;
      :
      :
    The values for value_for_a, etc, are set via your GUI, and you include the resulting 'C' source file (c_file) in your uVision Project