PDA

View Full Version : need to know if this is possible.



vtyler
- 16th June 2012, 04:27
i need to link 2 pics using serial. on one side it needs to monitor the state of a reed switch and if possible the charge level of a battery. on the other side the pic needs to trigger and opto and control a status led. i have been looking for a wile have coded a few things on pics but never anything using serial and can't find a solution.

Charlie
- 16th June 2012, 10:42
It's a simple matter to put a serial link between two devices. Go to the PBP help section and look up SERIN/SEROUT or SERIN2/SEROUT2 or HSERIN/HSEROUT if your PICs have hardware serial ports. I'm not sure why you would do this, however if all you are doing is what you described - the most basic single device could happily handle that functionality.

andywpg
- 17th June 2012, 01:13
It's a simple matter to put a serial link between two devices. Go to the PBP help section and look up SERIN/SEROUT or SERIN2/SEROUT2 or HSERIN/HSEROUT if your PICs have hardware serial ports. I'm not sure why you would do this, however if all you are doing is what you described - the most basic single device could happily handle that functionality.

Maybe the two halves are separated by some distance?

I understand that Phillips created I2C (Inter Integrated Circuit) just for having two chips talk to each other on the same board, so there must be a good reason for it.........

Charlie
- 18th June 2012, 02:43
Maybe the two halves are separated by some distance?

I understand that Phillips created I2C (Inter Integrated Circuit) just for having two chips talk to each other on the same board, so there must be a good reason for it.........
No one suggested a serial interface is never needed, but in this case (reading a voltage and counting closures of a reed switch, then turning on an LED or an opto) an 8 pin device is tons and 2 PICs with a link is overkill.

If you need to divide a voltage in half, you can use an A-D converter to sample the voltage, divide the measured result by 2 then use a D-A converter to construct a voltage based on the new number. You also need a power supply, clock source, and a handful of other parts. Or you can use 2 resistors of the same value - it's up to you.

vtyler
- 18th June 2012, 05:01
i should explain that the devices will not be physically connected to each other but the data is being send over rf transmuter pair the person I'm building if for has in stock. the project will be used to tell if a door is open and depending on if it is or not turn on and off a piece of equipment they already have in place.

Charlie
- 18th June 2012, 11:08
That makes more sense. Depending on the type of link, RF can be significantly more challenging. There are some (expensive) RF link modules that have RS-232 serial inputs. There are some cheap RF modules that will need Manchester or similar encoding in order to function. When you find out which type you have, search the forum - there's lots of good advice for both types here.

vtyler
- 19th June 2012, 01:25
i actually went searching through the parts bin and found some rf pairs that are not serial so i have it working with them.

thanks for the help