Prop to BS2 communication
computer guy
Posts: 1,113
How would i send commands to a BS2 from the prop.
i.e. send "10" to the BS2 from the prop.
get the BS2 to receive "10" and do something.
BS2 -
If value = 10
do this
else if value = 11
do this
end if
prop -
send 10
do i need a resistor between the prop and bs2 or any other circuitry.
Thank you
i.e. send "10" to the BS2 from the prop.
get the BS2 to receive "10" and do something.
BS2 -
If value = 10
do this
else if value = 11
do this
end if
prop -
send 10
do i need a resistor between the prop and bs2 or any other circuitry.
Thank you
Comments
2) You could use all kinds of ways to get a value from one to the other. On the BS2, use SERIN. On the Propeller, use the FullDuplexSerial driver from the Propeller Tool's library. I recommend using 2400 Baud so the BS2 has a little time to interpret the data as it's received. On the Prop end, if you declare "FullDuplexSerial" as "ser", you'd use "ser.dec(10)" then "ser.tx(13)" to provide a return character. On the BS2, use "SERIN <pin>,<Baud>,[noparse][[/noparse]DEC v]" and you should see a value of 10 in the variable v. <pin> is the transmit pin (from the Stamp's perspective) and <Baud> is the appropriate Baud constant for 2400 Baud.
Do look at the comments for FullDuplexSerial. It talks about the initialization routine call needed. Typically, it would be "ser.start(<recv pin>,<xmit pin>,%0000,2400)" where <recv pin> and <xmit pin> are for receiving and transmitting (from the Propeller's standpoint).
Post Edited (Mike Green) : 3/18/2007 2:53:27 AM GMT
I have a BS2 laying around that i was going to use for a robot, I am now using a prop though and have no use for the BS2.
If you can come up with a cheaper way or controlling 2 7 segment displays, without making programming the prop hard (i know nothing about i2c or creating bits of information from a string or decimal).
Your advise would be great.
Thank you
The Prop should be happy with the 1K series resistor you've shown. If you make a mistake with the Stamp's program and happen to make P0 a high (+5V) output while the Prop is trying to output a low (0V), the maximum current will be about 5ma ... no sweat for either chip. If P0 is a high output for the Stamp and an input for the Prop, the maximum current through the Prop's protective diode will be 5V-3.3V-0.7V=1V with 1K = 1ma, again no sweat.
All i want to do is display numbers on a 2x 7 seg display without using 14 i/o pins on my prop.
The TPIC6595 is an 8-bit high power serial shift register that you could drive from the Prop with only 3 I/O pins and is cascadable. It works like a combination of a 74HC595 and a ULN2803, both well described in Parallax's documentation.
Post Edited (Mike Green) : 3/18/2007 4:11:57 AM GMT
I already gave him the Eagle library and schematics for this, not sure why the wild goose chase. It can't get simpler than the i2c. The PCF8574 or other option Mike mentioned will sink the LEDS no problem, you don't even need the ULN2803s, just two PCF8574's- 2 wires to the existing EEPROM SCL and SDA, I posted the code already, it is no brainer.
How would you send i/o pins 1 and 6 high for example.
Thank you
This makes pins 1 and 6 high( assuming you are numbering the pins from least sig bit to high). To sink the LEDs in the real world case, you would want to do the opposite logic, LOW pin = LED ON, unless you are using a ULN28xx, in which case keep the logic normal, the HIGH output would TURN ON the transistor, causing the transistor to SINK the LED to GND.
Post Edited (originator) : 3/18/2007 4:56:40 AM GMT
thank you
set the address according to the 3 address pins on the device, device type = %1011 + address = %001
You cannot get the PCF8475 in DIP, only SMT. The 8574 is available in DIP, unless you want another challenge to deal with in soldering SMT parts.
Post Edited (originator) : 3/18/2007 6:02:59 AM GMT
Use common A segments to sink the catchode separely, your eagle library should have each ca and ck you can serach 7 segment and see all the listings partnumber + CA are what you want.
Post Edited (originator) : 3/18/2007 6:02:07 AM GMT
With the 2x 7 seg display being Common Anode.
Send output low to give led ground and turn led on.
Post Edited (computer guy) : 3/18/2007 6:09:41 AM GMT
For example, you could set up a seprated methods or case statements for each letter. I don't know how simple or complex your needs are to judge what to do, here is a very simple idea
I would study this datasheet, remember for future ref, this IC will not source anything unless you use pullups, but it will sink no problem.
focus.ti.com/lit/ds/symlink/pcf8575.pdf
Thank you
An example:
%11111111 'byte 1 = all off
%10000000 'byte2 = "8"
You could think of the segments as two separately controlled devices, so that if you know that byte 1 = %10000000 = 8 and byte 2 %11111111 = OFF, you could do a constant table
CON
DIS8 = %10000000
OFF = %11111111
And in your i2c.write, you now do
i2c.start
i2c.write(OFF)
i2c.write(DIS8)
i2c.stop
or something like that
Also note that you can do one start and any number of data bytes following the start, as long as the data bytes are in pairs, so you could even stream values to the LED segments very rapidly, just keep it always byte1 byte2 byte1 byte2, The stop is not required between the flow of data bytes, only when you are done with the device, you can stop.
Where byte1 and byte2 are varables being updated elsewhere. If the EEPROM or other I2C device on the same lines need to do something, you have to stop the loop.
Post Edited (originator) : 3/18/2007 8:13:24 AM GMT