what is the easiest way to control a pic from a pc?

Started by mr_gees100_peas July 21, 2006
Lets ay you are on a budget and you already have some 16f877a pics
laying around and a bunch of other parts (resistors, caps etc etc).
You have your compiler and pic programer and what not. Now you want to
create a program and control your pic. Maybe make it blink an LED.
SOmethignsimple. What would be the easiest way to do this. Take into
account the cost. For example you can get free C/C++ compiler for the PC .

I've been looking on the web but the steps described are complicated
and not well detailed. There should be a tutorial or something that is
device or programming language independant.

--- In p..., "mr_gees100_peas" wrote:
>
> Lets ay you are on a budget and you already have some 16f877a pics
> laying around and a bunch of other parts (resistors, caps etc etc).
> You have your compiler and pic programer and what not. Now you want to
> create a program and control your pic. Maybe make it blink an LED.
> SOmethignsimple. What would be the easiest way to do this. Take into
> account the cost. For example you can get free C/C++ compiler for
the PC .
>
> I've been looking on the web but the steps described are complicated
> and not well detailed. There should be a tutorial or something that is
> device or programming language independant.
>

I'm not certain I understand what you mean by "control a PIC from a
PC". So, I'll guess...

You want to create a program and download it to the PIC, right? You
have at least 3 choices (I'll skip JAL): You can use the Microchip
MPLAB suite to write the program in assembly language and load the
resulting .HEX file to the PIC using your programmer.

You can use the free version of PIC C Lite to write the program in C
and, ultimately, download the resulting .HEX file to the PIC using
your programmer.

You can use the demo version of cc5x to write the program in C and do
the same thing as above for PIC C Lite. I use cc5x.

I skip JAL because I haven't used it, not because it isn't viable.

Note that both cc5x and PIC C Lite can be intergrated into the MPLAB
IDE so you can use the Microchip software to edit the files and the
compilers to generate the .HEX file. If your programmer is compatible
with MPLAB, you never need to leave the IDE.

There are other alternatives but they tend to cost money. PIC Basic
Pro is a good choice but pricey.

Another approach for loading code into the PIC is to use a boot
loader. You can look at Bloader and Screamer at
http://www.sparkfun.com/commerce/hdr.php?p=tutorials. There is a
version for the 16F877A and the 16F88

You can also use PICLoader (or the revised version for the 877A) and
the BotLoader program on the PC end to send files. This requires you
start your code at 0x003 and that is easier with cc5x than PIC C Lite.
But, the bootloader works over the serial port and doesn't require an
external programmer. This approach is used on the MiniSumo Mark III.
You can join that group on Yahoo and get the files you need.

Hope I touched on the right question!

Richard

Have you tried this site:
http://www.rentron.com/Myke5.htm
It doesn't get much easier and it may just be that tutorial you're
looking for.

HangGlider
--- In p..., Arlen Fletcher wrote:
>

Hi,

I guess I should had been more specific. SOmetimes I don't want to
give too much information because people tend to concentrate in other
issues other than the problem I'm trying tom solve. In this case it
back fired. I didn't mean programing the PIC I meant controlling the
pic or talking to pic through the PC. For example build a simple C or
C++ program on the PC that waits for an user input. For the sake of
the example lets say that the users has to type LED ON and when he/she
press enter on the PC the C program goes and send a code to the PIC
through the an USB wire. The pic receives the code and then turns on
the LED.Then the PIC send a message back to the PC to say hey I
receive the message.

My idea was to build a simple robot. The robot would have a pic
micro that does some basic control like controlling the motors,
detecting obstacles through IR detectors, counting disstance travel
and comunicating through the PC. The pic would send a signal through
amube a radio transmiter to a radio receiver that is hook up to the
PC. The radio receiver is also control by another PIC. The message
send by the PIC in the robot should be simple. Maybe a hex code that
says there is an object in front of my and the distance that it had
travel. Now, there should be a program on the pc (probably a C++
program since its free and thats the language I know) that acts as the
brains of the robot. The program calculates current positions, path
finding and keeps traks of objects found by the robot. Once the PC
finds a solution it tells the PIC trhat controls the radio to tell the
robot what to do. FOr example, send a series of hex codes that is
equivalent to how to move. Something like turn lesf then go foward 3
feet, then turn right go foward 5 inches then turn right and travel
another 3 feet and finally turn left and you have cleared the obstacle.

The thing is I could probably figure out how to do the navigation
and motr control and what not. There are many examples everywhere.
What I cannot find good information on is how to interface any pic to
a PC though the USB port. Well, the wiring is available but how to
program that is the problem.
> Have you tried this site:
> http://www.rentron.com/Myke5.htm
> It doesn't get much easier and it may just be that tutorial you're
> looking for.
>
> HangGlider
>
MAX3420E keeps showing up in projects.

Latest is in Aug 06 Circuit Cellar

Norm

----- Original Message -----
From: mr_gees100_peas
To: p...
Sent: Saturday, July 22, 2006 9:46 PM
Subject: [piclist] Re: what is the easiest way to control a pic from a pc?
--- In p..., Arlen Fletcher wrote:
>

Hi,

I guess I should had been more specific. SOmetimes I don't want to
give too much information because people tend to concentrate in other
issues other than the problem I'm trying tom solve. In this case it
back fired. I didn't mean programing the PIC I meant controlling the
pic or talking to pic through the PC. For example build a simple C or
C++ program on the PC that waits for an user input. For the sake of
the example lets say that the users has to type LED ON and when he/she
press enter on the PC the C program goes and send a code to the PIC
through the an USB wire. The pic receives the code and then turns on
the LED.Then the PIC send a message back to the PC to say hey I
receive the message.

My idea was to build a simple robot. The robot would have a pic
micro that does some basic control like controlling the motors,
detecting obstacles through IR detectors, counting disstance travel
and comunicating through the PC. The pic would send a signal through
amube a radio transmiter to a radio receiver that is hook up to the
PC. The radio receiver is also control by another PIC. The message
send by the PIC in the robot should be simple. Maybe a hex code that
says there is an object in front of my and the distance that it had
travel. Now, there should be a program on the pc (probably a C++
program since its free and thats the language I know) that acts as the
brains of the robot. The program calculates current positions, path
finding and keeps traks of objects found by the robot. Once the PC
finds a solution it tells the PIC trhat controls the radio to tell the
robot what to do. FOr example, send a series of hex codes that is
equivalent to how to move. Something like turn lesf then go foward 3
feet, then turn right go foward 5 inches then turn right and travel
another 3 feet and finally turn left and you have cleared the obstacle.

The thing is I could probably figure out how to do the navigation
and motr control and what not. There are many examples everywhere.
What I cannot find good information on is how to interface any pic to
a PC though the USB port. Well, the wiring is available but how to
program that is the problem.
> Have you tried this site:
>
>
> http://www.rentron.com/Myke5.htm
>
>
> It doesn't get much easier and it may just be that tutorial you're
> looking for.
>
> HangGlider
>
Sorry, previous post was for speedy USB.
Easier USB control is through an emulated serial port.
http://www.ftdichip.com/
another option
http://www.ghielectronics.com/USBwiz.htm
Norm
----- Original Message -----
From: Norm Carlberg
To: p...
Sent: Saturday, July 22, 2006 10:12 PM
Subject: Re: [piclist] Re: what is the easiest way to control a pic from a pc?

MAX3420E keeps showing up in projects.

Latest is in Aug 06 Circuit Cellar

Norm

----- Original Message -----
From: mr_gees100_peas
To: p...
Sent: Saturday, July 22, 2006 9:46 PM
Subject: [piclist] Re: what is the easiest way to control a pic from a pc?
--- In p..., Arlen Fletcher wrote:
>

Hi,

I guess I should had been more specific. SOmetimes I don't want to
give too much information because people tend to concentrate in other
issues other than the problem I'm trying tom solve. In this case it
back fired. I didn't mean programing the PIC I meant controlling the
pic or talking to pic through the PC. For example build a simple C or
C++ program on the PC that waits for an user input. For the sake of
the example lets say that the users has to type LED ON and when he/she
press enter on the PC the C program goes and send a code to the PIC
through the an USB wire. The pic receives the code and then turns on
the LED.Then the PIC send a message back to the PC to say hey I
receive the message.

My idea was to build a simple robot. The robot would have a pic
micro that does some basic control like controlling the motors,
detecting obstacles through IR detectors, counting disstance travel
and comunicating through the PC. The pic would send a signal through
amube a radio transmiter to a radio receiver that is hook up to the
PC. The radio receiver is also control by another PIC. The message
send by the PIC in the robot should be simple. Maybe a hex code that
says there is an object in front of my and the distance that it had
travel. Now, there should be a program on the pc (probably a C++
program since its free and thats the language I know) that acts as the
brains of the robot. The program calculates current positions, path
finding and keeps traks of objects found by the robot. Once the PC
finds a solution it tells the PIC trhat controls the radio to tell the
robot what to do. FOr example, send a series of hex codes that is
equivalent to how to move. Something like turn lesf then go foward 3
feet, then turn right go foward 5 inches then turn right and travel
another 3 feet and finally turn left and you have cleared the obstacle.

The thing is I could probably figure out how to do the navigation
and motr control and what not. There are many examples everywhere.
What I cannot find good information on is how to interface any pic to
a PC though the USB port. Well, the wiring is available but how to
program that is the problem.
> Have you tried this site:
>
>
> http://www.rentron.com/Myke5.htm
>
>
> It doesn't get much easier and it may just be that tutorial you're
> looking for.
>
> HangGlider
>
--- In p..., "Norm Carlberg" wrote:
>
> Sorry, previous post was for speedy USB.
> Easier USB control is through an emulated serial port.
> http://www.ftdichip.com/
> another option
> http://www.ghielectronics.com/USBwiz.htm

Thanks. This is a hell of a good starting point.
> Norm
> ----- Original Message -----
> From: Norm Carlberg
> To: p...
> Sent: Saturday, July 22, 2006 10:12 PM
> Subject: Re: [piclist] Re: what is the easiest way to control a
pic from a pc?
>
> MAX3420E keeps showing up in projects.
>
> Latest is in Aug 06 Circuit Cellar
>
> Norm
> ----- Original Message -----
> From: mr_gees100_peas
> To: p...
> Sent: Saturday, July 22, 2006 9:46 PM
> Subject: [piclist] Re: what is the easiest way to control a pic
from a pc?
> --- In p..., Arlen Fletcher wrote:
> > Hi,
>
> I guess I should had been more specific. SOmetimes I don't want to
> give too much information because people tend to concentrate in
other
> issues other than the problem I'm trying tom solve. In this case it
> back fired. I didn't mean programing the PIC I meant controlling the
> pic or talking to pic through the PC. For example build a simple
C or
> C++ program on the PC that waits for an user input. For the sake of
> the example lets say that the users has to type LED ON and when
he/she
> press enter on the PC the C program goes and send a code to the PIC
> through the an USB wire. The pic receives the code and then turns on
> the LED.Then the PIC send a message back to the PC to say hey I
> receive the message.
>
> My idea was to build a simple robot. The robot would have a pic
> micro that does some basic control like controlling the motors,
> detecting obstacles through IR detectors, counting disstance travel
> and comunicating through the PC. The pic would send a signal through
> amube a radio transmiter to a radio receiver that is hook up to the
> PC. The radio receiver is also control by another PIC. The message
> send by the PIC in the robot should be simple. Maybe a hex code that
> says there is an object in front of my and the distance that it had
> travel. Now, there should be a program on the pc (probably a C++
> program since its free and thats the language I know) that acts
as the
> brains of the robot. The program calculates current positions, path
> finding and keeps traks of objects found by the robot. Once the PC
> finds a solution it tells the PIC trhat controls the radio to
tell the
> robot what to do. FOr example, send a series of hex codes that is
> equivalent to how to move. Something like turn lesf then go foward 3
> feet, then turn right go foward 5 inches then turn right and travel
> another 3 feet and finally turn left and you have cleared the
obstacle.
>
> The thing is I could probably figure out how to do the navigation
> and motr control and what not. There are many examples everywhere.
> What I cannot find good information on is how to interface any
pic to
> a PC though the USB port. Well, the wiring is available but how to
> program that is the problem.
> > Have you tried this site:
> >
> >
> > http://www.rentron.com/Myke5.htm
> >
> >
> > It doesn't get much easier and it may just be that tutorial
you're
> > looking for.
> >
> > HangGlider
>
Hi Arlen,

I'm looking to control stepper motors (CNC) via USB. I was just told
about this site that gets you up and going with a CDC example for USB.

http://pic18fusb.online.fr/wiki/wikka.php?wakkaCOMx

You could start with RS-232, and then "step up" to USB using this approach.

If I was going for a wireless link, I'd use AX.25 packet protocol (I'm a
Ham).

Alan KM6VV

mr_gees100_peas wrote:
> --- In p..., Arlen Fletcher wrote:
> Hi,
>
> I guess I should had been more specific. SOmetimes I don't want to
> give too much information because people tend to concentrate in other
> issues other than the problem I'm trying tom solve. In this case it
> back fired. I didn't mean programing the PIC I meant controlling the
> pic or talking to pic through the PC. For example build a simple C or
> C++ program on the PC that waits for an user input. For the sake of
> the example lets say that the users has to type LED ON and when he/she
> press enter on the PC the C program goes and send a code to the PIC
> through the an USB wire. The pic receives the code and then turns on
> the LED.Then the PIC send a message back to the PC to say hey I
> receive the message.
>
> My idea was to build a simple robot. The robot would have a pic
> micro that does some basic control like controlling the motors,
> detecting obstacles through IR detectors, counting disstance travel
> and comunicating through the PC. The pic would send a signal through
> amube a radio transmiter to a radio receiver that is hook up to the
> PC. The radio receiver is also control by another PIC. The message
> send by the PIC in the robot should be simple. Maybe a hex code that
> says there is an object in front of my and the distance that it had
> travel. Now, there should be a program on the pc (probably a C++
> program since its free and thats the language I know) that acts as the
> brains of the robot. The program calculates current positions, path
> finding and keeps traks of objects found by the robot. Once the PC
> finds a solution it tells the PIC trhat controls the radio to tell the
> robot what to do. FOr example, send a series of hex codes that is
> equivalent to how to move. Something like turn lesf then go foward 3
> feet, then turn right go foward 5 inches then turn right and travel
> another 3 feet and finally turn left and you have cleared the obstacle.
>
> The thing is I could probably figure out how to do the navigation
> and motr control and what not. There are many examples everywhere.
> What I cannot find good information on is how to interface any pic to
> a PC though the USB port. Well, the wiring is available but how to
> program that is the problem.
>
>>Have you tried this site:
>>http://www.rentron.com/Myke5.htm
>>It doesn't get much easier and it may just be that tutorial you're
>>looking for.
>>
>>HangGlider
>>
>
>
Agreed. The simplist way to talk to a PIC from a PC is to use RS-
232. Most PIC language implementations have some serial RS-232
protocol keywords or library calls.

And even if you ultimately use USB, the USB port tends to look to
the PC like another RS-232 port anyway.

--- In p..., Alan Marconett wrote:
>
> Hi Arlen,
>
> I'm looking to control stepper motors (CNC) via USB. I was just
told
> about this site that gets you up and going with a CDC example for
USB.
>
> http://pic18fusb.online.fr/wiki/wikka.php?wakkaCOMx
>
> You could start with RS-232, and then "step up" to USB using this
approach.
>
> If I was going for a wireless link, I'd use AX.25 packet protocol
(I'm a
> Ham).
>
> Alan KM6VV
>
> mr_gees100_peas wrote:
> > --- In p..., Arlen Fletcher wrote:
> >
> >
> > Hi,
> >
> > I guess I should had been more specific. SOmetimes I don't
want to
> > give too much information because people tend to concentrate in
other
> > issues other than the problem I'm trying tom solve. In this case
it
> > back fired. I didn't mean programing the PIC I meant controlling
the
> > pic or talking to pic through the PC. For example build a simple
C or
> > C++ program on the PC that waits for an user input. For the sake
of
> > the example lets say that the users has to type LED ON and when
he/she
> > press enter on the PC the C program goes and send a code to the
PIC
> > through the an USB wire. The pic receives the code and then
turns on
> > the LED.Then the PIC send a message back to the PC to say hey I
> > receive the message.
> >
> > My idea was to build a simple robot. The robot would have a
pic
> > micro that does some basic control like controlling the motors,
> > detecting obstacles through IR detectors, counting disstance
travel
> > and comunicating through the PC. The pic would send a signal
through
> > amube a radio transmiter to a radio receiver that is hook up to
the
> > PC. The radio receiver is also control by another PIC. The
message
> > send by the PIC in the robot should be simple. Maybe a hex code
that
> > says there is an object in front of my and the distance that it
had
> > travel. Now, there should be a program on the pc (probably a C++
> > program since its free and thats the language I know) that acts
as the
> > brains of the robot. The program calculates current positions,
path
> > finding and keeps traks of objects found by the robot. Once the
PC
> > finds a solution it tells the PIC trhat controls the radio to
tell the
> > robot what to do. FOr example, send a series of hex codes that is
> > equivalent to how to move. Something like turn lesf then go
foward 3
> > feet, then turn right go foward 5 inches then turn right and
travel
> > another 3 feet and finally turn left and you have cleared the
obstacle.
> >
> > The thing is I could probably figure out how to do the
navigation
> > and motr control and what not. There are many examples
everywhere.
> > What I cannot find good information on is how to interface any
pic to
> > a PC though the USB port. Well, the wiring is available but how
to
> > program that is the problem.
> >
> >>Have you tried this site:
> >>
> >>
> >>http://www.rentron.com/Myke5.htm
> >>
> >>
> >>It doesn't get much easier and it may just be that tutorial
you're
> >>looking for.
> >>
> >>HangGlider
> >>
> >
> >
> >
> >
> >
> >
> >
> >
> > to unsubscribe, go to http://www.yahoogroups.com and follow the
instructions
> >
Hi Allan,

That's certainly true! The CDC class appears to do just that. However I
was of the impression that the original poster (Arlen) wanted USB. Still
might be a good idea to get RS-232 running first, then "step up" to USB.

One could use one of the FTDI chips, although I'm inclined to go with the
18F4550. The boot loader might be a good idea also. Then the program can
be downloaded over USB. Could also download over RS-232, of course.

Alan KM6VV
> -----Original Message-----
> From: p... [mailto:p...] On Behalf
> Of Allan Lane
> Sent: Tuesday, August 08, 2006 11:28 AM
> To: p...
> Subject: [piclist] Re: what is the easiest way to control a pic from a pc?
>
> Agreed. The simplist way to talk to a PIC from a PC is to use RS-
> 232. Most PIC language implementations have some serial RS-232
> protocol keywords or library calls.
>
> And even if you ultimately use USB, the USB port tends to look to
> the PC like another RS-232 port anyway.
>
> --- In p..., Alan Marconett wrote:
> >
> > Hi Arlen,
> >
> > I'm looking to control stepper motors (CNC) via USB. I was just
> told
> > about this site that gets you up and going with a CDC example for
> USB.
> >
> > http://pic18fusb.online.fr/wiki/wikka.php?wakkaCOMx
> >
> > You could start with RS-232, and then "step up" to USB using this
> approach.
> >
> > If I was going for a wireless link, I'd use AX.25 packet protocol
> (I'm a
> > Ham).
> >
> > Alan KM6VV