Log in

View Full Version : Trying to integrate Visual Basic with PIC 16f877a



vtolentino
- 4th March 2011, 15:49
Hello buddies,

I'm new here and this is my first post. The last year of Mechatronic Engineering course is driving me crazy.
My classmates and myself are trying to build a manipulator arm assisted by computer.
The idea is the following:
1. Design the mechanical arm;
2. Program a PIC so as to control the arm
3. Control the arm from the computer by a interactive screen where the users could input values of coordinates.

The first big problem we've found was the fact we don't know how to build a software capable to control an external equipment (manipulator arm).
I've found some materials concerning the integration HMI - Human Machine Interface. As I'm a novice in this field of expertise, I'd like to know if you guys could lead us or even give us some tips.
I intend to use Visual Basic to send a signal in order to control the manipulator arm, though I don't know if it's the best solution. I mean, maybe there is another way to control a external equipment with a interactive screen (computer).
OBS: We don't have any experience in Visual Basic. :D

Please, let me know you can help me !!! :)

Thanks in advance,


Victor Oliveira Tolentino

John_Mac
- 5th March 2011, 00:20
Quite a while ago I wrote something similar. A Visual Basic program running on a PC that communicated with a PIC through the serial port. Visual Basic will let you fashion a GUI with buttons etc to execute code. I was controlling a pan and tilt servo device, so my buttons were up/down/left/right/center/scan. Each button just sent a command (a number) to the serial port. The PIC listened to the serial port and depending on what command was sent, would drive the proper servo by the desired amount.

I think I had some handshaking so the PC program knew when the PIC was done.

For a manipulator arm you might want to have the PIC send back some position info.

There may be better ways to do this, but this worked and was pretty simple. Visual Basic has lots of serial port examples to start from.

There are also good Visual Basic tutorials to learn it. But if you have no experience in coding, plan on investing some time.

Later on, I converted this to a Web page. Visual Web Developer (also part of Visual Studio) has a lot of what Visual Basic has and the programs carry over without a lot of effort. That way you can control the arm over the internet.

John

fixitjs
- 9th March 2011, 07:06
there are plently of users here that have done what your trying to to do. VB can easily do what you're trying to do. the trick to it is getting from vb through windows to the pc hardware. i'm still learning but thus far it appears like

initialize serial port
open port
read / write port
repeat
when done close port

of course the syntax is everything. i saw an example on this forum not long ago, so keep digging. i have seen a number of users use hyperterminal to do a quick test of their hardware. i was searching for temperature related projects but there are endless other types too.

i've switched from VB to delphi, so i think i'll find fewer examples to help me here. good luck, stuggle on and succeed!

gadelhas
- 9th March 2011, 09:22
Hi;

See this post that i posted some time ago. Is an exemple how to work with VB and COM Port to talk to a PIC.

http://www.picbasic.co.uk/forum/showthread.php?t=13609&p=92628#post92628