|
| |||||||||||||||||||
|
Tell a friend about this site Robotics Projects: Electronics Projects: Project Log: Links: |
Serial Multiplexer ProjectDesign:
The design is pretty simple really, connect the RX and TX lines of each sonar unit to the PIC. In code, the PIC reads the data off each TX line and then sends the read data through the voltage level converter (MAX232 chip) to the host PC. Implementation:I used MPLAB v7.0 to write the code, and I compiled it with the CCS PCH compiler. The sonar module's output is an inverted RS-232 signal -- so in order to read data from them you have to invert them. This can be done either with an inverter (with input: sonar TX; output: PIC RX), or you can automatically invert the signal in code. I tested the inverter method to make sure it worked -- it did, but in the end I did the inversion in code, so I wouldn't have to wire up another chip.According to the datasheet, the sonar modules only output data when their RX pin is high (+5v). They output the sonar reading, in one inch increments every 49mS. I read the data from the sonar modules in round-robin style:
Sample OutputExample output of a single sonar module:
R006
R006 R010 R012 R035 R035 R035 Example output of the Serial Multiplexer:
Sonar MUX v.1
Author: Andrew Wilson 5/2006 reconnsworld.com sonar1: 025 sonar2: 006 sonar1: 025 sonar2: 006 sonar1: 025 sonar2: 006 sonar1: 025 sonar2: 006 sonar1: 025 sonar2: 006 Code and HEX FileTo see the source code, follow this linkFor the 18F1320 hex file, click here Final WordsThis project works pretty well. However it may be a good idea to implement time-outs in the program. Right now, if one sonar module is broken the program will be stuck waiting for data that never comes. This will keep the program from ever moving forward.If you're interested in having me build one of these units for you, send me an email using the feedback form. project added: 6/11/2006 |
| |||||||||||||||||