Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 25th December 2006, 04:20 PM   (permalink)
Default Can we Program PIC Microcontroller in Microsoft Visual C??

Q No:1- Which is the better Visual C# OR Visual C++ and why????

Q No:2- Can we program PIC Microcontrollers in Visual C# OR Visual C++, if yes then how, if not than why not???

Q No:3- What we need to program PIC in Visual C# OR Visual C++???
Ayne is offline  
Old 25th December 2006, 04:34 PM   (permalink)
Default

your first question doesn't make any sense, it's like asking "which is better, english or french?" (or any other language) It's a matter of personal preference and everyone is entitled to their opinion.

No, you cannot program a PIC in VC++ or VC#. That also doesn't even make any sense, both are written for 32-bit and 64-bit computer systems, it's crazy to think they would work on a PIC.

It is possible to program PICs in plain old C, there are a lot of compilers for that. There are one or two compilers around somewhere for C++, however they never got very popular, probably because many of the features of C++ are way too complicated to be used (or needed) on an 8-bit microcontroller.

Once again, you really need to consider what kind of extremely simple hardware you're programming for. The kind of stuff that is fine on a PC is incredibly inefficient on a PIC - 32-bit values, floating-point math, etc. There's nothing stopping you from doing some amazing stuff with these 8-bit microcontrollers, you just have to be creative in your programming.
__________________
EEgeek.net

Last edited by evandude; 25th December 2006 at 04:37 PM.
evandude is offline  
Old 25th December 2006, 04:55 PM   (permalink)
Default

Infact I am planing to learn one of those languages but i don't know which is best for me. Infact my object is make graphs in computer and other programs that control my Embedded system from PC.
Ayne is offline  
Old 25th December 2006, 05:40 PM   (permalink)
Default

Wait, are you talking about programming the PIC, or writing a PC program to interface with the PIC?

If you're talking about writing a PC program to interface with the PIC, then it's another story entirely. Either VC++ or VC# can do it quite well, as can Visual BASIC if you like that language. If you're using the .NET 2.0 framework with any of those languages, interfacing with the serial port (which is the simplest way to interface with a microcontroller from a PC) is quite easy. The first time I played with the System.IO.Ports.SerialPort object in C#, I was able to put together a simple 2-way communication serial terminal program as a demo within an hour or so.
__________________
EEgeek.net

Last edited by evandude; 25th December 2006 at 05:47 PM.
evandude is offline  
Old 25th December 2006, 06:10 PM   (permalink)
Default

I want to write PC programs, like u said interfacing with the serial port and making graphs and other programs.
I have read many stories that C++ is more powerfull than C#. What is ur view?
I think i will go with C++ what u say??
Ayne is offline  
Old 25th December 2006, 06:13 PM   (permalink)
Default

Quote:
Originally Posted by Ayne
I want to write PC programs, like u said interfacing with the serial port and making graphs and other programs.
I have read many stories that C++ is more powerfull than C#. What is ur view?
I think i will go with C++ what u say??
Either are equally powerful really, it's down to what you do with them - I would expect C# to be more resource hungry and run slower?.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 25th December 2006, 06:38 PM   (permalink)
Default

Pretty much, Nigel. C++ pretty much invariably makes much faster programs, but it's also a lot more complicated to write programs in general, ESPECIALLY if you want to create applications with a GUI, as opposed to a command-line-only application.

C# is a completely object-oriented language, which is generally a very intuitive programming model, and it's generally a lot easier to write programs with it. It's also a very managed language; it makes you be clearer about what you are trying to do so you don't leave as many ambiguities and make as many stupid mistakes. With visual studio, or some of the other IDE's out there, creating a GUI application is as easy as dragging and dropping some objects (serial port, buttons, text boxes, etc) onto a form, and then writing some code to tie them together. As I said, a basic app using serial communication can be thrown together very easily, in very little time. Visual BASIC is very similar to C#, everything is structured about the same way, it just comes down to your preference of C vs BASIC.

It really comes down to what you're looking for. If you want raw speed, try C++ (or even C). Just be prepared to learn a lot - even something like opening a single, empty window in VC++ can take several dozen lines of code. If you don't want to spend a ton of time programming, something like C# or VB might be a better choice. Personally, I prefer to spend less time programming my PC software and more time working on the hardware and firmware of the PIC system, even if it means my application runs a little slower.

But just for the sake of comparison, I wrote a USB bootloader app in C#, and it takes on the order of 4 or 5 seconds to do a complete read of an 18F4550. The Microchip demo application, which is written in C++, takes about the same amount of time, maybe a second faster, but not much more. To me, the additional time that it would have taken for me to write such an application in C++ would not be worth the savings of a second or so every time it's used. If you were in an industrial setting and needed to perform this action tens of thousands of times a day, as fast as possible, then this speed difference would probably matter to you a whole lot more.

I think probably the best thing you can do is to just go search around the web and look for some example code. I'd recommend http://www.codeproject.com/ . Look at some demo applications in C++ and in C# and compare the code, and see which one you think you'd prefer.
__________________
EEgeek.net

Last edited by evandude; 25th December 2006 at 06:45 PM.
evandude is offline  
Old 25th December 2006, 10:10 PM   (permalink)
Default

Because you do not know C, C++, or C# I suggest you use C#. They all will work, but I think you will get apps working faster with C#. It can be easier to make things happen in C#, it does more for you, hides more details. It will use more CPU time, but a modern PC has more then enough power to handle it.

I think you will find that visual studio is a good environment to learn and program in. A bonus is that you can find C# examples that explain most of the problems you will run into on the net.

Regardless of which VS language you use you will be working with the .Net framework. The .NET 2.0 has easy to use serial port support. You drag the serialport from the toolbox to you forms design, set the baud rate etc in the properties window, and write a data recieved callback (function called on data recieved) and you are ready to go.

3v0
3v0 is online now  
Old 26th December 2006, 07:10 AM   (permalink)
Default

C# and C++ are both powerful in there own class. if you want to know under the hood working of system, and tweak it (forget asm ) then VC++ is the choice , and it is the native language of windows . if you just need to put a program as fast as possible with little headache , then VC# is the language to choose.
__________________
Gods own Country
Incredible !ndia

www.flickr.com/photos/_akg/

"Give a man a fish, and he will eat for a day. Teach that man to fish, and he will eat for a lifetime."
akg is offline  
Old 27th December 2006, 10:22 AM   (permalink)
Default

Between those two, I say go with C++. There are C / C++ compilers for just about every chip / OS ever made, and many of them are free. C# only has one compiler, which only writes binaries for Windows.

If you want something in a simple / high-level scripting language, I'd look into Python and Java. They're both extremely popular, and are well-supported on a lot of architectures.
i_build_stuff is offline  
Old 28th December 2006, 12:55 AM   (permalink)
Default

Quote:
Originally Posted by i_build_stuff
Between those two, I say go with C++. There are C / C++ compilers for just about every chip / OS ever made, and many of them are free. C# only has one compiler, which only writes binaries for Windows.

If you want something in a simple / high-level scripting language, I'd look into Python and Java. They're both extremely popular, and are well-supported on a lot of architectures.
From http://www.mono-project.com/Main_Page
Quote:
What is Mono?

Mono provides the necessary software to develop and run .NET client and server applications on Linux, Solaris, Mac OS X, Windows, and Unix. Sponsored by Novell (http://www.novell.com), the Mono open
3v0
3v0 is online now  
Old 28th December 2006, 05:15 PM   (permalink)
Thumbs up

Ayne:
I understand you are new to microcontrollers but please do not plaint seeds that directly or indirectly envolve M$ with this discipline. One, such a union does not fix anything since nothing is broken. Two, such a union could only lead to the hindering of the other. Three, such a union creates complication, increased resource, and monitary, volumetric, and temporal dependencies. In other words it puts more to get out the same which inarguably means to get less. Those who have intiment knowledge of the two know why one has continually advance and the other remains relatively static.

Lets not forge microcontrolling coding from a state of being potentially to that of a guaranteed slow, ambiguous, redundant, excessive, inefficient, bloated, and monopolized. If I can save you one of them its all be worth it.
donniedj is offline  
Old 28th December 2006, 05:30 PM   (permalink)
Default

of course u can't...
choose the MIKROC compiler..u could also found a lot of helping files there
__________________
rabusanad.tripod.com
raedbenz is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
visual basic program for parallel port interface group_x3m Micro Controllers 5 26th May 2006 02:49 AM
How to connect LED detector 2 Pins?..program microcontroller Terrano General Electronics Chat 3 31st March 2005 05:38 PM
Tough assembly program for the PIC16F84 asmpic Micro Controllers 34 3rd December 2004 07:50 PM
Visual BAsic communications with a microcontroller Erwin_Macaraig Micro Controllers 2 22nd November 2004 01:12 AM
PicBasic Keypad program Sora Micro Controllers 0 20th April 2004 08:02 PM



All times are GMT. The time now is 06:38 PM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker