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.

How to program a serial interface for PIC with PC ?

Status
Not open for further replies.

Jundiaí

Newbie level 6
Joined
Sep 12, 2002
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
78
How can i do it?

I have a PIC comunicating with the PC by the Hyper Terminal, but now i need create a interface to the users and i don't know how. I know how to program a few in delphi, c++ and labview, but i have never programed a serial interface. Which language i must utilize? How can i do it?

All help will be welcome

Antonio.

Sorry about the english mistakes (heeheh)
 

Re: How can i do it?

The best way is to use VB. It is helpful especialy if you are planing to some sort of debuging from PC.

You can use any language C or C++.

regards
 

it all depends on your application, Vb is the best choice for simple application, ,a lot of resources is available for it.

share the application with us to give the right choice.

regards,

Sherif.
 

Re: How can i do it?

The quickest way to do it would be in VB, using MSComm control. MSComm control comes with Professional and Enterprise versions of VB.
Unfortunately, it doesn't come with the Learning edition of VB. However, if you search the web, you're likely to find the downoad of it. With MSComm doing most of the work, the VB code to receive serial data is very simple.
The same is true for microcontroller code for devices such as PIC, AVR, or Basic Stamp. For example, in Stamp Basic or PIC Basic, you just use the Serout command to send serial data to PC. I include a couple links to articles that contain detailed examples of how it's done, including VB source code, and Basic code for a microcontroller. If you don't have access to PIC Basic compiler, you may go to MicroEngineering Labs website (the company that makes Basic Compilers for PIC chips), and use their online demo compiler. Otherwise you need to write the code in assembler. Also there is a popular book on serial communications that has some good stuff in it. It's Serial Port Complete by Jan Axelson.
Happy coding !

http://www.rentron.com/receiving_data.htm

**broken link removed**

http://www.melabs.com/

Cheers,
Greg.
 

Re: How can i do it?

You said you already got comms with hyperterminal.

Why don't you build a menu from PIC in the hyperterminal window with ASCII characters?

Users can make selections for settings etc. The PIC can accept user input via serial link and act as needed: update values in hyperterminal window or store new settings in EEPROM.

Works fine if you don't have too much info to present to user.
 

Re: How can i do it?

You could try using the Java Communications API and write a GUI in Java. I am suggesting Java since making a GUI (using Swing) is very straight forward and there are many tutorials on doing it. The Communications API handles both serial and parallel ports on the computer.

All you need are the following:
1. Sun Java SDK: http://java.sun.com/j2se/1.4.2/download.html
2. The Java Communications API: http://java.sun.com/products/javacomm/ it comes with sample source code of working programs.
3. To learn how to make a GUI: http://java.sun.com/docs/books/tutorial/uiswing/mini/

- Jayson
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top