Continue to Site

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.

  • 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.

Interfacing the PIC to a computer

Status
Not open for further replies.

YAN-1

New Member
Hi everyone. As part of a project, I need to interface many PICs to an original intel mother board so that data can flow between the PICs and my pentium 4 processor. I think I will use a PCI card but I am not sure how to deal with the difference in operating frequencies between the 'fast' mother board and the 'slow' PICs. I think I am going to use the serial port in the PICs but do I need to use external buffers and FIFOs? Has this been done before? Thanks.
 
Why not just use the parallel port? One PIC per data line. That will allow you to interface 8 PICs at once in parallel. If you wanted to link more you could go serial and use a small data header with an addressing system to indicate which PIC the data is intended for.

Dan East
 
YAN-1 said:
Hi everyone. As part of a project, I need to interface many PICs to an original intel mother board so that data can flow between the PICs and my pentium 4 processor. I think I will use a PCI card but I am not sure how to deal with the difference in operating frequencies between the 'fast' mother board and the 'slow' PICs. I think I am going to use the serial port in the PICs but do I need to use external buffers and FIFOs? Has this been done before? Thanks.

You need to be far more specific about what you are wanting to do (and why?) - you may also be surprised how fast a 'slow' PIC is, and how slow your 'fast' PC is. The speed of a Pentium 4 is basically all inside the processor, for I/O it's greatly slower.

The serial port on the PC can run at 115Kb, and a PIC can easily run at that as well - however, PIC's only have very small amounts of memory, so generally such speeds don't give much advantage, because you've only got small amounts of data to shift.

But again, it depends what you are trying to do?.
 
well the problem is i will have to read 8 pins at once and then form a byte each time. i am afraid the PCI will be sending data to the PICs faster than i can read the pins.
 
YAN-1 said:
well the problem is i will have to read 8 pins at once and then form a byte each time. i am afraid the PCI will be sending data to the PICs faster than i can read the pins.

You still don't give any clue as to what you're wanting to do, so how do you expect advice?.
 
YAN-1 said:
well the problem is i will have to read 8 pins at once and then form a byte each time. i am afraid the PCI will be sending data to the PICs faster than i can read the pins.
PCI? Are you crazy... that bus is 32bits wide with lots of controlling od the MotherBoards chipset. This will be a difficult task to do! Maybe if you use ISA or standart serial/paralel interface, but PCI, I want to see that! 8)
 
ok ok. sorry. let me clarify. this is the story:
i am controlling a car. now a main program run by the pentium 4 will do certain calculations and send for example the required speed of the car to a PIC so that it can control a dc motor on the gas pedal. now there is a PIC to control the speed, another for the steering, and so on. the pentium will send these orders to the PICs through the PCI card. but i am not sure whether to use serial or parallel interface and how to make sure the data transfer rates match so that i don't lose any data?
 
YAN-1 said:
ok ok. sorry. let me clarify. this is the story:
i am controlling a car. now a main program run by the pentium 4 will do certain calculations and send for example the required speed of the car to a PIC so that it can control a dc motor on the gas pedal. now there is a PIC to control the speed, another for the steering, and so on. the pentium will send these orders to the PICs through the PCI card. but i am not sure whether to use serial or parallel interface and how to make sure the data transfer rates match so that i don't lose any data?
This sounds pretty simple. Just use serial port on your PC and interface it to the PIC. If you use HW USART of the PIC, then there are no wories of loosing data or going out of sync.

Where did you get idea of using PCI for that?
 
well the thing is ISA buses are extinct and there will also be like 3 other PICs that send information to the pentium about the obstacles around the car through sensors. so i have a lot of data going both ways and i need something fast. i don't think the serial will work. what's wrong with PCI?!
 
YAN-1 said:
ok ok. sorry. let me clarify. this is the story:
i am controlling a car. now a main program run by the pentium 4 will do certain calculations and send for example the required speed of the car to a PIC so that it can control a dc motor on the gas pedal. now there is a PIC to control the speed, another for the steering, and so on. the pentium will send these orders to the PICs through the PCI card. but i am not sure whether to use serial or parallel interface and how to make sure the data transfer rates match so that i don't lose any data?

That's an entirely different story!.

As Jay says, why are you talking about PCI cards?, you only need a VERY SLOW interface, you're controlling slow mechanical devices - a 9600 baud serial interface would be plenty fast enough.

Basically you're wanting to 'radio control' a car?, your main problems will be mechanical - you will need to buy (or make yourself) large powerful servo systems to handle the controls.

Incidently, standard radio control system use pulse width coding to drive the servos, these are refreshed every 20mS - that's only 50 times a second!. This provides perfectly acceptable control, and 9600 baud would beat that by a good margin! - no need for anything faster at all.

There's also probably no need to use multiple PIC's?, you could use a single one to receive the 9600 baud serial data, and output pulse width codes to drive servos. Such devices are freely available, and commonly used in robotics!.

BTW, I don't know if you ever watch Mythbusters, but they radio controlled a full size car - to check the 'drive shaft breaking' myth.
 
YAN-1 said:
well the thing is ISA buses are extinct and there will also be like 3 other PICs that send information to the pentium about the obstacles around the car through sensors. so i have a lot of data going both ways and i need something fast. i don't think the serial will work. what's wrong with PCI?!
Yes, ISAs are not available on new PCs... If serial is too slow, try Paralel (Aprox 600KB pre second thourghput) or USB (12Mb speed), they should be fast for anything...
What exactly are you gonna transfer from PC to PICs that it requires that fast medium?
 
Nigel,
i am not sure what you mean by 'radio-control'
so you're basically suggesting that one PIC sends and receives and then it distributes data to the other PICs?
 
YAN-1 said:
Nigel,
i am not sure what you mean by 'radio-control'
so you're basically suggesting that one PIC sends and receives and then it distributes data to the other PICs?
He ment, that maybe you don't 3 PICs but maybe I main PIC would do the job. Tell us exactly what you want to do... :)
 
ok guys. this is the complete story:
there is a PIC controlling a stepper motor for the steering; there is another PIC controlling the gas and brake pedals for the speed; there will be 2 or 3 PICs connected to sensors around the car, and all these PICs have to send their data to the pentium and receive orders from it all the time. what is the best way to connect the mother board to the PICs?
is it clear?
 
YAN-1 said:
ok guys. this is the complete story:
there is a PIC controlling a stepper motor for the steering; there is another PIC controlling the gas and brake pedals for the speed; there will be 2 or 3 PICs connected to sensors around the car, and all these PICs have to send their data to the pentium and receive orders from it all the time. what is the best way to connect the mother board to the PICs?
is it clear?
Now its clear. I think that if you use one 16F877 OR 18F chip, that would suffice! Also you didn't mention how do you want to have it connected with PC, by Wire or Wireless? Wire sollution is easy, you take one MAX232 connect it to PIC and to the COM port of your PC. Then you can send commands to the PIC using hyperterminal or your own Software.

You have no Idea how this would be complicted using PCI bus...
 
radio control means remote control using radio waves. Race cars are made with this technique. (transmitter and receiver).
 
it will not be wireless. the pc will be on the car. the program run by the pentium will be probably written in C++ under linux. will the serial port be appropriate for such a real time application? it is extremely important that information about the obstacles around the car don't reach the pc too late!
 
ok .. i get ya.. pentium is in the car , running everything..
i have only worked with the ISA bus , which is cake..
 
YAN-1 said:
ok guys. this is the complete story:
there is a PIC controlling a stepper motor for the steering; there is another PIC controlling the gas and brake pedals for the speed; there will be 2 or 3 PICs connected to sensors around the car, and all these PICs have to send their data to the pentium and receive orders from it all the time. what is the best way to connect the mother board to the PICs?
is it clear?

A single fast PIC can do all that. Try using a PIC18F452 running at 40Mhz clock speed (10Mhz crystal X 4). The problem with using multiple PICs is that although each PIC is running a single task, the overhead for communications will probably rob you of any gain.

The easy way is to use the serial communications port running at the highest baud rate you can set the PIC on. You can also use an RS-232 to RS-422 in a multi-drop arrangement to several PICs. There is also application notes on CAN (controller area network) on Microchip's website.

There are also PCI to microcontroller adapter chips available out there. I can provide a link once I get to the office.

If you can manage to produce a PCI interface, why not control the I/O directly from the PC? Except maybe for the stepper motor controller, you can do I/O directly from the PC port. You may have to write a device driver for the PC operating system however. :shock:

HTH
 
Status
Not open for further replies.

Latest threads

Back
Top