Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

MCU programming Software(Windows) Development help Required.

Status
Not open for further replies.

UroBoros

Advanced Member level 2
Joined
May 5, 2004
Messages
642
Helped
19
Reputation
38
Reaction score
8
Trophy points
1,298
Location
Cochin - India
Activity points
6,463
Hai
I am relatively new to PC programming.

I am trying to develop a Windows based application to programe microcontroller.(Presently I am doing it for 8051). The programmer hardware has got a firmware chip and my software has to send data to that through serial port. A lot of examples are in net just like easy downloader for 8051.

but so far I was not able to locate an example sourse code to communicate to serial port (OF the PC). I have to read a hex file and send the data to serial port so that firmware will receive it and write to the target controller.

I have started studing Visual C for this purpose. So far I have created screens for the application and all from books. But so far I was not able to locate any tutorial which can read a hex file and send the data and also display the bufer of Hex file.
Please suggest me the links for tutorilas or example programes for meeting this purpose

I must do it in Visual C not in VB.

Thanks

picstudent
 

Re: MCU programming Software(Windows) Development help Requi

What about an application written in LabView?

Regards,
IanP
 

    UroBoros

    Points: 2
    Helpful Answer Positive Rating
Re: MCU programming Software(Windows) Development help Requi

IanP said:
What about an application written in LabView?

What is that?

picstudent
 

Re: MCU programming Software(Windows) Development help Requi

LabView is very different to VB, VC and all the other stuff .. see pictures below ..
Please spend some time and have a look at the following links:
**broken link removed**


Regards,
IanP
 

    UroBoros

    Points: 2
    Helpful Answer Positive Rating
Re: MCU programming Software(Windows) Development help Requi

visual C has several file management fuction (ie: fopen, etc) you might used those funtion and get content file then send it content (hex data) via serial com
regards
 

    UroBoros

    Points: 2
    Helpful Answer Positive Rating
Re: MCU programming Software(Windows) Development help Requi

Ian,
Doesn't Lab View cost a few THOUSAND dollars? I don't think they have a student, hobby, or demo version available, do they?
 

    UroBoros

    Points: 2
    Helpful Answer Positive Rating
Re: MCU programming Software(Windows) Development help Requi

Hai
Thanks for the replies.I am enquiring weather labview will be affordable!

e_eja said:
visual C has several file management fuction (ie: fopen, etc) you might used those funtion and get content file then send it content (hex data) via serial com
regards

can you give some more info on how to get the content file and configure serial port?


picstudent
 

Re: MCU programming Software(Windows) Development help Requi

you can order free LabView catalogue via National Instrument website.
 

    UroBoros

    Points: 2
    Helpful Answer Positive Rating
Re: MCU programming Software(Windows) Development help Requi

Hi,
I think were loosing track here.
picstudent, you need to go through the 8051 programming guide. Then you need to know how to read tge hex file and dump it to the serial port. A monitor program must be used for this.

I know there are some code around one of these sites:
http://www.pjrc.com/tech/8051/
http://www.boerde.de/~matthias/m8051/
http://www.faqs.org/faqs/microcontroller-faq/8051/
**broken link removed**
http://www.acebus.com/win8051.htm
Go through the sites.
Any program can only be written when you know the basic structure of the DEVICE. The Front end or Gui can bre written in any language.

You wil lalso need a 8051 simulator to test the code.
 

    UroBoros

    Points: 2
    Helpful Answer Positive Rating
I would suggest that you download visual c++ express from Microsoft. It is a free download. The windows form designer is quite easy to use, a lot better than visual c. One of the components in the forms designer is a comport. You can just drop this on your form and you have rs232 comms. You can find sample code on how to use the commport in the help files.
You can also download visual c# express and visual basic express from Microsoft for free. They all have a similar interface. I like the c# version.
 

    UroBoros

    Points: 2
    Helpful Answer Positive Rating
Re: MCU programming Software(Windows) Development help Requi

Picstudent,

Correct me if I am wrong, but I think the trouble you are having is accessing the comm port, correct?

I don't have visual C, but I think there must be an mscomm control like the one that comes in visual b, no? That should handle that part of the problem. Once you have comms open, then you will need to find out from the links which docel gave you how the chip expects the hex file.

Regards,
Robert
 

    UroBoros

    Points: 2
    Helpful Answer Positive Rating
Re: MCU programming Software(Windows) Development help Requi

Hai

Thank you all for the replys. I will download the required softwares from microsoft.

Regarding my exact requirement I will clarify once again.

The microcontroller side is ok for me. Because I have studied datasheets and other documents which gives the programming specifications of those Atmel chips.Morover I have got example programes for the firmware which clearly defines how to impose this hex data into the chip and fuse there.

but my deadlock is on the side of delivering the hex file from PC to the firmware chip in proper order so that firmware can handle it. And I wish to do it in Visual C.

So i want to know the methods for two things.
1) How to send data through serial port.I think now I have some information regarding that like MScomm control or other activeX control from microsoft or some other sourse. I am studying those aspects.Actually I am new to PC programming and words like classes ,wrapper etc are confusing for me. But I am managing through links from sourses like you.
2) The next issue is the method to provide a editable buffer for my interface so that the hex file can be editted within my interface just like many MCU programmer interfaces.

I am going through the book of Visual C in 21 days. Doing some small dialogue based applications now.

Thanks a lot for the links.
Will keep in touch.
picstudent
 

Re: MCU programming Software(Windows) Development help Requi

Hello picstudent,

If your problem is only serial port handling,

If you have VC++ running in your machine, you do not need any controls or any other software. Go to codeproject **broken link removed**
and check for the serialport classes. One of good one in list is CSerialport v1.03
https://www.codeproject.com/system/cserialport.asp.

Integrate the CSerialport class to your project, (just add the serialport.cpp file and serialport.h file to your project). you can use as simple as this.

Code:
      CSerialPort comport;
      char czBuffer[BLEN];
      dw dwNunOfBytes;

      comport.Open(1, 9600, CSerialPort::NoParity, 8, 
      CSerialPort::OneStopBit, 
      CSerialPort::NoFlowControl);

      //Fill the data in czBuffer
     comport.Write(czBuffer, dwNunOfBytes);
     
     //dwNunOfBytes = set the number of bytes expected if any
     comport.Read(czBuffer, dwNunOfBytes);

Cheers
idlebrain
 

    UroBoros

    Points: 2
    Helpful Answer Positive Rating
Re: MCU programming Software(Windows) Development help Requi

There are a wide variety of libraries available for serial communication, most notably the ones provided directly with the windows API. the GetComm(xxxx) and SetComm(xxxx) contain the majority of the commands you need. look in the API reference for the complete guide.

If you need something simpler use visual basic and use the Comm control. It has an easy to use wrapper.

speaking of visual basic, you can download it for free as well as visual c++ from microsoft themselves (for a limited time).

https://msdn.microsoft.com/vstudio/express/vb/download/default.aspx
https://msdn.microsoft.com/vstudio/express/visualc/download/default.aspx
 

    UroBoros

    Points: 2
    Helpful Answer Positive Rating
Re: MCU programming Software(Windows) Development help Requi

Hi

Im happy to help you

here is a few examples

first the file attached is comvdd sources for the dll i am writing now

it has a class called comport.cpp i also wrote from scratch
to my own needs as many of the ones i found had problems with xp

i decided to write a semi low level affair
as you mention you need port access this works fully in bidirectional
file transfers with any comport

youll see how i mounted the class into this dll project

{code is untidy and not very optimised yet} but youll get the idea

and then how to call a instance of the class

although this can be done in your app at any time to spawn a comport
by just adding the file to the sources and adjust its headers


i didnt impliment fully yet the port exception catches but youll see whats going on

it is a well documented class
with excerpts of the win32 api http://www.winprog.org/tutorial/

although personaly i prefer digitalmars

as µ soft visual c++ is a bit joe bloggs

and dosnt perform some types of conversions very well
without moaning at you



the next example is of coms is a programmer for flash writing code
made in visual c++
by a guy called Carlos Buelna its a freeware one
and you can download the very latest version
**broken link removed**

or see this site **broken link removed**

i found his sources very usefull
 

    UroBoros

    Points: 2
    Helpful Answer Positive Rating
Re: MCU programming Software(Windows) Development help Requi

idlebrain said:
Hello picstudent,

If your problem is only serial port handling,

If you have VC++ running in your machine, you do not need any controls or any other software. Go to codeproject **broken link removed**
and check for the serialport classes. One of good one in list is CSerialport v1.03
https://www.codeproject.com/system/cserialport.asp.

Integrate the CSerialport class to your project, (just add the serialport.cpp file and serialport.h file to your project). you can use as simple as this.

Code:
      CSerialPort comport;
      char czBuffer[BLEN];
      dw dwNunOfBytes;

      comport.Open(1, 9600, CSerialPort::NoParity, 8, 
      CSerialPort::OneStopBit, 
      CSerialPort::NoFlowControl);

      //Fill the data in czBuffer
     comport.Write(czBuffer, dwNunOfBytes);
     
     //dwNunOfBytes = set the number of bytes expected if any
     comport.Read(czBuffer, dwNunOfBytes);

Cheers
idlebrain


nana wont work on XP ....try it...
you must use instead .net to compile it not visual c++


as the mechanism isnt there and blocked even if you use other runtimes
 

    UroBoros

    Points: 2
    Helpful Answer Positive Rating
Re: MCU programming Software(Windows) Development help Requi

VSMVDD said:
nana wont work on XP ....try it...
you must use instead .net to compile it not visual c++
as the mechanism isnt there and blocked even if you use other runtimes

What you mean?

Such serial ports using classes compiled in Visual C++ wont work in XP?

Please clarify?

I am going through your DLL , But using DLL at this initial stage is more confusing for a beginner than using a communications control available with Visual C++.

What is the drawback (if any) of using "Microcsoft Communications control" avaialble in VC as a activeX control?

Regarding
**broken link removed**

Have you noticed any bug or problem in this "downloader" class he uses?
your opinion?

Thanks
picstudent
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top