Interfacing Visual Studio with PIC

Thread Starter

Dritech

Joined Sep 21, 2011
901
Hi all,

This is my first time that I am going to interface Visual Studio with a PIC 18F4550 (or any similar PIC) microcontroller. Can someone please tell me the best method to use to interfacing? and does anyone know of any good beginners tutorial please?

Any help would be appreciated.
 

Papabravo

Joined Feb 24, 2006
21,228
Hi all,

This is my first time that I am going to interface Visual Studio with a PIC 18F4550 (or any similar PIC) microcontroller. Can someone please tell me the best method to use to interfacing? and does anyone know of any good beginners tutorial please?

Any help would be appreciated.
If Visual Studio means the Microsoft IDE, your task is going to be nearly impossible. Microsoft has no intention of developing a compiler for the PIC processor line -- IMHO.
 

tshuck

Joined Oct 18, 2012
3,534
Are you meaning to say that you'd like to interface a PIC to an application produced with Visual Studio, or are you trying to program a PIC from Visual Studio?

The first isn't too hard, depending on the tools you decide to use.

The second is a bit more difficult. You'd probably have to setup some(a lot of) work arounds to get it to work...
 

Thread Starter

Dritech

Joined Sep 21, 2011
901
Are you meaning to say that you'd like to interface a PIC to an application produced with Visual Studio, or are you trying to program a PIC from Visual Studio?
Hi, sorry for not being so clear. I want to interface the PIC with a VS application. What is the best way for interfacing please? and do you know of any tutorials for beginners? Thanks in advance.
 

BobTPH

Joined Jun 5, 2013
9,003
Your PC app and the PIC will have to communicate with each other. How do you intend to do this? Hint: the most likely ways would be serial RS232 or USB.

Bob
 

tshuck

Joined Oct 18, 2012
3,534
Hi, sorry for not being so clear. I want to interface the PIC with a VS application. What is the best way for interfacing please? and do you know of any tutorials for beginners? Thanks in advance.
I have used this in the past, or, there are those little Bluetooth modules (if your computer supports Bluetooth); both use a UART interface to a virtual COM port on your computer.

Writing an application using the .NET framework is as simple as dragging the 'Serial Port' control onto a window in the designer, then writing the interaction logic to use it.

Unfortunately, I haven't seen a tutorial on this, but one probably exists, I'll take a look later, provided I remember...
I had planned to write a tutorial myself, but haven't worked up to it yet.;)
 

Thread Starter

Dritech

Joined Sep 21, 2011
901
Thanks for the replies. I have another question. In a form I created a button named SAVE. Every time this button is pressed I want a constantly changing value and character to be saved in two variables INT and CHAR respectively. Now my problem is how to initialize the variables?? lets say the user presses the SAVE button for 40 times, does that mean that I have to initialize 40 integers and 40 characters at the beginning of the coding?? is there an easier way to do this? Thanks
 

tshuck

Joined Oct 18, 2012
3,534
You are getting into implementation details, but you have yet to specify what your implementation is.

I suspect you are using Windows Forms (WPF also uses a designer) and C#, it this the case?

We will need more info before we can do much else...
 

Thread Starter

Dritech

Joined Sep 21, 2011
901
Basically I am doing a robotic arm for my end for year school project. This arm will be controlled using Visual Basic in Form and programmed in C#. The robotic arm will have feedback potentiometers with every moving part/lever.
Attached is the one of the forms used for this project. Another form consists of arrow buttons which are used move the arm. When the desired position is set, the user will press the SAVE POSITION button. When this button is pressed, the attached form will pop. Here the user is asked to give the position a name, the desired moving speed of each part/lever and the time delay after position is reached (if necessary).

The user can keep on maneuvering the arm and saving different positions as explained above. When the desired number of positions are saved, the user can save the pattern where it can later be loaded. When loaded the robotic arm will follow each position (saver earlier) simultaneously.

The is the best way that I can explain it. Hope it is somehow clear and sorry for my poor English.
Thanks in advance.
 

Attachments

tshuck

Joined Oct 18, 2012
3,534
[...]This arm will be controlled using Visual Basic in Form and programmed in C#.
So you are using something like the PICAXE? And you are using WinForms?


[...]When this button is pressed. the attached form will pop. Here the user is asked to give the position a name, the desired moving speed of each part/lever and the time delay after position is reached (if necessary).
Say what?

Do you mean that a new window will pop up and ask for information? If so, this is called a dialog window...


You may want to look into some of the .NET framework constructs and classes, like the Queue class; this allows you to save generic objects in a queue and push and pop things from it in a FIFO action, this way, you could save waypoints into the queue and pop them as the arm maneuvers to the specified waypoint.

I want a constantly changing value and character to be saved in two variables INT and CHAR respectively. Now my problem is how to initialize the variables?? lets say the user presses the SAVE button for 40 times, does that mean that I have to initialize 40 integers and 40 characters at the beginning of the coding??
If you are simply writing to the same variables for the INT and CHAR, you'll just overwrite the previous values each time. You can initialize them in the startup functions.
 

Thread Starter

Dritech

Joined Sep 21, 2011
901
So you are using something like the PICAXE? And you are using WinForms?
I am going to use a PIC18f and yes I am using windows form.

Say what?

Do you mean that a new window will pop up and ask for information? If so, this is called a dialog window...
I will pop the form attached in post #10. Actually it will ask the user to input data such as position name etc.

If you are simply writing to the same variables for the INT and CHAR, you'll just overwrite the previous values each time. You can initialize them in the startup functions.
And what if I want then to be saved in different variables? do I have to initialize all the variables?

Thanks.
 

Rigby

Joined Apr 10, 2014
1
If Visual Studio means the Microsoft IDE, your task is going to be nearly impossible. Microsoft has no intention of developing a compiler for the PIC processor line -- IMHO.
I'm about 8 months late with this reply, and I apologize for that. I found this thread via Google, while looking for information about what I've quoted above, not the original intention of the thread originator. I'm not intending to add to the discussion, but to provide some information for folks who wind up here from Google in the future. Read on if you're one of those folks.

One can create what's called a "makefile project" in Visual Studio 2010 and up, that can be used to compile and deploy PIC projects, or Arduino, or AVR, or Atmel, or whatever you have. Visual Studio doesn't do the compiling, so you'll still need your compiler, and Visual Studio can do everything else. It can be (pretty easily) configured to use the proper intellisense for the platform you're developing on, and compiler errors and warnings are brought into the IDE just like normal via the compiler's STDOUT and STDERR. Debugging and such also look like they'll work if I'm reading a few other sites properly (which I very well may not be.)

A little more googling will get you there.

Visual Studio is a great tool, and this works with the free Express versions of Visual Studio as well.

All of that said, it might not be the best tool depending on what you're doing; look closely at alternatives.
 
I'm about 8 months late with this reply, and I apologize for that. I found this thread via Google, while looking for information about what I've quoted above, not the original intention of the thread originator. I'm not intending to add to the discussion, but to provide some information for folks who wind up here from Google in the future. Read on if you're one of those folks.

One can create what's called a "makefile project" in Visual Studio 2010 and up, that can be used to compile and deploy PIC projects, or Arduino, or AVR, or Atmel, or whatever you have. Visual Studio doesn't do the compiling, so you'll still need your compiler, and Visual Studio can do everything else. It can be (pretty easily) configured to use the proper intellisense for the platform you're developing on, and compiler errors and warnings are brought into the IDE just like normal via the compiler's STDOUT and STDERR. Debugging and such also look like they'll work if I'm reading a few other sites properly (which I very well may not be.)

A little more googling will get you there.

Visual Studio is a great tool, and this works with the free Express versions of Visual Studio as well.

All of that said, it might not be the best tool depending on what you're doing; look closely at alternatives.

What are some of the alternatives? and thanks for the above! very useful
 
Top