Desktop Computer controlled car

Thread Starter

rakan

Joined Apr 11, 2007
3
Hello,

I am working on a project. I need your opinion about my plan of executing this project because i am not an expert in robotics and recently started learning such fields.

I am aiming to build a car that is to be controlled by desktop computer. There will be several circuits for this robot:
1) The desktop computer: containing a desktop application that will send information to transmitter circuit using parallel port.
2) Transmitter circuit: Which will receive data from parallel port into 1 16F84A PIC then outputs to another 16F84A PIC to control send to RF transmitter in analogue form.
3) Receiving circuit: which will contain a RF receiver which will receive data to a PIC of the same kind. processes the data and passes instructions to 2nd PIC which will instruct the H-Bridge to move 2 DC motors.

Transmitter Circuit:
I have chosen to use 2 PICs because of that one of them will go into an infinite loop scanning for high voltages in pins coming as input from parallel port output. and the other one is also going to an infinite loop to send an endless stream of data from transmitter to receiver using timing and delays. We all know that we cannot insert two programs into a single PIC and even if we can, we still cannot run two programs at the same time.

Receiving Circuit:
The same reason for using two pics in transmitter circuit but one of them is going to a loop for getting data from receiver using timing and delays in addition for the loop in the other PIC that will output instructions to h-bridge for movement of car.

I feel that i am not doing the correct thing here, i need ur critics about my plan of execution and the way i think. If you know that i am doing something wrong here or can be improved please state. I want to see all what you think about regarding this project.

Best Regards,
Rakan
 

hgmjr

Joined Jan 28, 2005
9,027
The use of two pics is certainly feasible as one approach.

As you indicated a single processor cannot execute two separate programs at the same time. There are however a couple of strategies that can be used to achieve the execution of two separate processes within one microcontroller.

One way is to use time-slicing in which each process is given a small window of time in which to advance its process. After this window of time is up, the process in suspended and another process is given control. The length of time allocated to a given process is contingent on the time criticallity of its tasks.

Another technique used is called a state machine. Each state machine is called sequentially from the main loop. Each state machine upon being called checks the various flags to determine whether or not to advance to the next state and then returns control back to the main loop.

I have attempted to crudely describe what is a somewhat complex concept but I hope I at least conveyed a sense of what is taking place.

You can do some research on the Internet and learn more about the details of these and other such techniques.

hgmjr
 

Thread Starter

rakan

Joined Apr 11, 2007
3
Hello,

Thanks for your replies.

hgmjr: Multitasking is what you are talking about. Implementing a multitasking code in addition to the code that will receive inputs, process then outputs signals is a tough task which i dont think i will be able to do because i am kinda new to assembly programming. It is a low level language you know :)

Regarding interrupts. Let's say that 16F84A micros do have them, if not i can still use 877 family. I was told interrupts can help me remove some of the complexity here but i still dont know How can interrupts help me??


Thanks again.

Rakan
 

thingmaker3

Joined May 16, 2005
5,083
Instead of tying up a second chip waiting for an event, use the event to trigger an interrupt. The PIC will stop what it was doing and pay attention to the input, performing whatever subroutine needed. Check your manual for details. Half as many chips is half as many chips!
 
Top