• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Serial Communication with PIC18F4520 to control DC motors

Status
Not open for further replies.

Ecappp

New Member
Specifications:
Microcontroller: PIC18f4520
Crystal: 4 MHz
Language: C Programming (not assembly codes)
Compiler: MPLAB C18 C Compiler (MCC18)

Hi everyone.

I intend to conduct a PC-to-PC communication. By sending any data from the transmitting computer, I will receive the data at the receiving computer and I want to use that data to generate analogue voltage accordingly to the DC motors. For example, a data of "4.356" is sent from the transmitting side, I have to convert this actual string to an actual analogue voltage to generate to the DC motors. I have tried "Google" and saw that to accomplish this, serial communication is needed. However, I have some major problems:

1) I am totally new to serial communication. I saw people using EUSART to do that but I have totally no idea how to do that.

2) How do I convert the data of "4.356"(For example) to an actual analogue voltage?

I have already tried communication via hyperterminal on both the transmitting and receiving side and communication works well! It is only the C programming part of PIC18F4520 that I totally have no clue on how to even start.

Can anyone please tell me how to start on this serial communication to fufill my purposes? Any comments, examples on the C programming is really much appreciated. Really need help on this.
 

Russ Hensel

New Member
Do not use hyperterminal use an alternative PC-Microcontroller Communications - Open Circuits

I have a program, for the 18f2550 ( in boostc ) which is very similar, that I will try to get posted in the next day or two. There should be other examples on the web, but the 18F series is new enought that most code needs some conversions.

Now posted at http://home.comcast.net/~russ_hensel/OC/DemoSerial_v5.zip

Some documentationat: http://www.opencircuits.com/Serial_Communications_(RS232)_in_BoostC
 
Last edited:

Ecappp

New Member
Hi Russ

Really thanks for replying. The links you gave me, I still don't quite get what's going on... Sorry but do you mind explaining how your program goes? One more thing, I couldn't open the files in the .zip file you attached...
 

Russ Hensel

New Member
Most of the explanation is in the files. They are mostly text files, should be no problem opening them. I just downloaded as a test and all seems fine.

You could get the free version of boostc to open all of them as a project. Let me know how it goes.

Any significant conversation should occur on the wiki discussion page.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top