Send data from bs2 to bs2
jbalat
Posts: 96
I want one bs2 to do a pulsin and then send this data to a bs2p with a pwmpal so it can generate a frequency..
How easy is this.
Note PWMPal uses P0 to connect with bs2p.
How easy is this.
Note PWMPal uses P0 to connect with bs2p.
Comments
The SEROUT and SERIN commands have built-in support for flow control.
Here is the connection diagram.
And here is a link to a N&V column no. 4: www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol3/col/nv81.pdf
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
Post Edited (dev/null) : 9/27/2009 9:26:26 AM GMT
--> Q) Is it possible to write the value of 'X' to a shared memory register so the 2 stamps do not need to synchronise with each other.. Keeping in mind that SPEED is my primary concern ???
All I want is to pulsout the input with a fixed offset.. I cant afford to do a serin unless it is quick enough so that it wont affect the continuous pulse from Stamp2.
STAMP1:
======
main:
PULSIN 9, X
(WRITE X TO REGISTER)
goto main
STAMP2: (up to 350 Hz)
=====
main:
(READ X FROM REGISTER)
PULSOUT 12, X + OFFSET
goto main
P.S. Cant use PWMPal since it keeps re-triggering
My understanding is that Stamp 1 will receive a pulse. Then, it will transmit a serial command to a BS2p which will then issue a command to the the PWMPAL.
Can you show us a sketch of the whole setup? How about the code you've written so far?
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
STAMP1(BS2) READ MAF PULSE
> STORE TIME 'X'
> LOOP
STAMP2(BS2P) READ TIME 'X'
> GENERATE PULSE OUT ('X'+OFFSET) ----> LOOP
METHOD: Stamp 1 will receive the pulse. I then want to make this value available (asynchronously) to the bs2p which will create a slightly different pulse with pulsout command in a continuous loop.
AIM: I am just trying to figure out the FASTEST way for the BS2p to get the value from Stamp1 so that you dont see any glitches in the pulse coming out of the BS2p. It does not matter whether Stamp1 has updated the value on every loop for the bs2p.
NOTES: 1) I dont want to use the PWMPal because it doesnt work properly. Supposedly Pulsout will continue from where it left off but the pwmpal just stops and restarts when it sees a new command.. Anyone want to buy it ?
2) SERIN/SEROUT seem to be slow because of the lack of buffering ? I just read in another post that writing the data to an external eeprom is very slow...
QUESTION: Can I write to the BS2p eeprom from Stamp1 ?
Post Edited (jbalat) : 9/30/2009 2:15:38 PM GMT
If the values will fit in a byte and you have a block of 8 I/O pins available (pins 0-7 or pins 8-15), you could simply set either OUTH or OUTL to the 8 bit value and read INH or INL on the 2nd Stamp like:
DIRL = $FF
main:
PULSIN 9,OUTL
GOTO main
and
main:
PULSOUT 12,INL + offset
GOTO main
Pins 0-7 of one Stamp would be connected through 8 - 220 Ohm resistors to pins 0-7 of the other Stamp.
You can't access the EEPROM of one Stamp from another. Theoretically you could, but it's not practical.
I like your thinking.. Dont know if I could convert these values to fall within 1 byte.
Minimum freq is about 25 Hz - Max is 350Hz
For 25Hz at 0.8us units for the BS2p, I think the time value may be around 50,000
I am only using 1 pin on stamp1 - pulsin
and 2 pins on the stamp2 - rctime for the offset, and pulsout
Post Edited (jbalat) : 9/30/2009 2:33:52 PM GMT
You would really do so much better with a Propeller. It uses 32 bits for its arithmetic and can do at least 8 things simultaneously like reading input pulse widths and producing output pulses.
I have no idea what a 74HC595 register is but I will have a look for some examples and see if it makes sense
Propellor also makes more sense than buying another bs2p..or infact 2 bs2p40's. Not quite sure what bits I need for a budget setup ?
As for overflow, it just occured to me that the pulsin/pulsout only sees/generates half of the pulse so I think the max value would be 25,000
Post Edited (jbalat) : 9/30/2009 2:48:38 PM GMT
And the single threaded Basic Stamp is a male, like myself, I can only do one thing at a time.
That's what SHE tells me, sometimes, and she is probably right.·
Mike is that all I need... the "USB Propeller Protoboard for $40" So I assume I plug in a standard printer USB cable, download the software and start programming ?
So why did I spend a fortune on the STAMP stuff !! BUGGER #$%
When I'm finished I will need to boost the output pulse to around 0-4.8v.. since I remember you said it would only output up to 3.5v
I will worry about this later if my ECU cant see the 3.5v signal
There's a long "sticky" thread on interfacing 5V logic to a Propeller. See under "Technical Considerations" here: http://forums.parallax.com/showthread.php?p=791527.
The new StingRay robot uses a nice 3.3V to 5V bidirectional level translator from TI (the TXB0108). This comes in a 4 bit version as well (TXB0104) and there are similar 2 bit (sn74lvc2t45) and single bit level translators (sn74lvc1t45). For just an output pulse, you could use any switching transistor with a pullup resistor (and a current limiting resistor for the base). You could also use any MOSFET with a gate-source voltage well below 3.3V (and a pullup).
Remember that the Stamps are very easy to use, have a tremendous amount of educational material developed for them mostly available for free, and do very well for single tasks.
Post Edited (Mike Green) : 10/1/2009 12:41:42 AM GMT
Is it any faster than the bs2p ?
Post Edited (jbalat) : 10/1/2009 6:52:43 AM GMT