Subject:
|
Re: FW: expansion board schematic posted
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Sat, 8 Feb 1997 06:26:18 GMT
|
Original-From:
|
Prabal Dutta <prabal@dmsc.comNOSPAM>
|
Reply-To:
|
prabal@IHATESPAMdmsc.com
|
Viewed:
|
1576 times
|
| |
| |
Sean,
Using two of the SPI port pins, and a MUX and DEMUX, you should be able
to gang together four of the Polaroid ultrasonic sensors. See if the
code below makes sense. I wrote it a while ago, when I wanted more
Polaroids, but - I didn't actually test it, so it might need some work
(both code and circuit). Hope that helps.
- Prabal
/*
* Purpose: Allows four ultrasonic sensors to be interfaced to the
* Handy Board while only sacrificing the pins necessary for one
* motor port.
* Requires: This file requires sonar.icb to function properly.
* Description: Use a 4-1 Multiplexer, and a 1-4 Demultiplexer in
* the figure below.
* Usage: The following hardware needs to be present:
*
* R = 330-1K ohm
*
* /|-----/\/\/\/------< BINH1
* / |-----/\/\/\/------< BINH2
* M2P1 >--------| |
* A0 ---\ |-----/\/\/\/------< BINH3
* A1 ----\|-----/\/\/\/------< BINH4
*
* /|------------------< INIT1
* / |------------------< INIT2
* M2P9 >--------| |
* A0 ---\ |------------------< INIT3
* A1 ----\|------------------< INIT4
*
*
* ECHO1 >-------|\
* ECHO2 >-------| \
* | |------------------< D7
* ECHO3 >-------| /--- A0
* ECHO4 >-------|/---- A1
*
*
* SPI port info:
* bits: SS=5, SCK=4, MOSI=3, MISO=2
* to turn on: poke (0x1009, 0x3C);
* these are the middle four pins of J6
* A0 = MISO
* A1 = MOSI
* Other connections:
* M2P1 = Motor Chip 2 (ports 2&3), pin 1
* M2P9 = Motor Chip 2 (ports 2&3), pin 9
*/
int WAIT_FOR_ECHO_TIME = 35L;
int SONAR_TIME_CONSTANT = 150;
int multiPing (int sensor) {
int A0 = 0, A1 = 0;
A0 = 0b01 & sensor;
A1 = 0x02 & sensor;
poke (0x1009, 0x3C);
if (A0) bitset (0x1008, 0b00000100);
if (A1) bitset (0x1008, 0b00001000);
ping (0);
msleep (WAIT_FOR_ECHO_TIME);
return (sonar_time/SONAR_TIME_CONSTANT);
}
MSI: Sean Cunningham wrote:
> I could really use that second sonar. I don't suppose there is a way
> you could design two parallel sonar connectors that are toggled with one
> of the digital outs? That way we wouldn't be taxing the handyboard
--
Prabal Dutta Tel: (614) 299-2566
Digital Micro Systems, Corp. FAX: (614) 299-2939
PO Box 3579 e-mail: prabal@dmsc.com
Columbus OH 43210-0579 WWW: http://www.dmsc.com
|
|
Message is in Reply To:
| | FW: expansion board schematic posted
|
| I'd agree with this option - I don't need any more inputs, but I do need 4 logical outputs 2-4 Hi-current outputs Serial communications 1 (preferably 2) sonar connectors I could really use that second sonar. I don't suppose there is a way you could (...) (28 years ago, 8-Feb-97, to lugnet.robotics.handyboard)
|
4 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|