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.

1 or 2 Wire transmission and servo control (PIC)

Status
Not open for further replies.

weegee

New Member
Hi

can anyone suggest a simple way of connecting between 1 and 7 Pic's (16f629) on a 1 or 2 wire bus. The data flow is one way only (from a host to the pics) i need to be able to send about 16 bits (including a 3 bit ID) along the bus, and when a packet is detected and the ID matches then the processor reacts (moves a servo), but does not interfere with the message in any way.

There may be more than 1 'reciever' containing the same id, and in that situation all that have the matching id should react simultainiously.

If i send the ID=0 then ALL units on the bus should respond.

I dont expect anyone to design this for me, just provide me with some advice on what sort of bus i should use, eg simple data + clock lines, ic2, spi, etc

I also need to feed the power to these 'slaves' (1st could be up to 1m from host, others daisy chained a max of 30cm apart) .

How would i do this, the slave will have a pic, and a servo in it, im looking for help with my options here, eg, can i feed 7.2v down a wire, and feed the servo, and tap that through a LDO regulator to feed the pic. As above there could be up to 7 of these slaves on one wire.
 
As there are no 8 pin pics with hardware communication, you will have to bit bang it. As the servos can be driven by a very short ISR you could bitbang RS232 as the main process. For something like this you probably only need 2400 baud which should be easily achievable using the internal clock. This would leave you 4 pins spare that you could use as address lines.

An alternative way to implement this would be the same as RC modules do it. The main pic sends a sync pulse (3mS) followed by a pulse for each servo. The receiving pics simply count pulses and then transfer their pulse to their output.

Mike.
 
hi pommie, thanks for the advice. i like the second option you have presented but im not sure that i could sort out the delays properly.

Would it work if i added a clock fed from the master pic...


hold data high for say 3 clock cyles to put the slaves into recieve mode, followed by the sixteen bits being clocked into the slaves. If the id matches then update the servo value on that slave, if not then ignore the packet.
and as you say an ISR can handle the servo, and would just read in the latest value stored.

I'll explain the scenario, i make digital gauges for cars, but it seems that customers want all the gauges that were analogue (speedo/revs) (yes i know there digital inside!) as a digital gauge (7 Seg), and all their digital gauges as analogue.

who knows?!?!?!?

anyway, i wanna build a central module that connects to all the sensors, then handles the digital bits, and outputs data for the analogue guages on the above mentioned bus.

ID=0 all devices respond (Will be used for power on/off signals, face illumination, and doing a self test)
ID=1 Water Temp
ID=2 Oil Temp
ID=3 Oil Pressure
ID=4 Boost
ID=5 Voltage
ID=6 Cant remember (and cant be bothered to dig out my paperwork, cos you get the idea)
ID=7 Power Reserve (Rolls Royce style power reserve eg, using 44% of available bhp)

the reason for the bus system is that you can have just one, or all 7 or any number inbetween of the gauges, and if i decide to face style, then its plug and play. i can mix and match, and add new gauges later.

thanks again
 
I would just stick with bitbanged RS232 as your main pic can then use the hardware to transmit without using any processor time.

If you need example code for the ISR, I have some that I wrote a while ago. I can did it out and post it if you like. For examples of bitbanged RS232 just go to Nigel's site.

Mike.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top