How would you send a text file to a BS2
JimDandy
Posts: 4
Hi all, first time poster here. I didnt find a topic that hit on what I am curious about. If you guys/gals could help me out with a problem I would be greatful.
I am trying to control a matrix of lights 6x6 for a total of 36 lights.
These lights will be controlled by relays which will be controled by the BS2 (control voltage for the relay).
I do not know where to begin? I have a text file that contains the matrix (binary 1/0) for the on/off for each light. this will be generated by another program.
I know that a program can be written to the stamps that converts a string of binary to the stamps and tells them which i/o pin should be high or low.
In other words, after I download the program to the BS2, how do send them a string of code to tell them which pins to turn on and off.
I mean how do I connect the BS2 to the text file that will be changing without haveing to plug the stamp in> program > then unplug and place back into the circuit.
I hope this isnt too scatterbrained for the point to get across.
thanks for any reply's,
Lane
I am trying to control a matrix of lights 6x6 for a total of 36 lights.
These lights will be controlled by relays which will be controled by the BS2 (control voltage for the relay).
I do not know where to begin? I have a text file that contains the matrix (binary 1/0) for the on/off for each light. this will be generated by another program.
I know that a program can be written to the stamps that converts a string of binary to the stamps and tells them which i/o pin should be high or low.
In other words, after I download the program to the BS2, how do send them a string of code to tell them which pins to turn on and off.
I mean how do I connect the BS2 to the text file that will be changing without haveing to plug the stamp in> program > then unplug and place back into the circuit.
I hope this isnt too scatterbrained for the point to get across.
thanks for any reply's,
Lane
Comments
On the one hand, it sounds like you want to have your PC connected to the BS2, send it data, have the BS2 read the data, and then turn on LEDs in a particular pattern.
On the other hand, it sounds like you have a text file of the patterns you want the lights to take. You then want to program the BS2 so it will cycle through the patterns without the PC connected.
To do the second approach, you need to turn your light patterns into DATA statements. Then cut and paste those DATA statements into the BS2 IDE. Then write some simple code for the BS2 to cycle through those DATA statements, and send the results out to the lights.
I don't know how complicated your patterns are, either. The BS2 has 2,000 bytes of EEPROM space. If the program takes 100 bytes, you have 1900 bytes of DATA space left. If, for each pattern, you did 5 bytes (40 bits) then you could fit 380 patterns in your EEPROM.
That's how I'd go about it, anyway.
Thinking that you might figure to send the data ("string of binary") to the STAMP as serial data. So, research "SERIN". Then you can 'interpret' that with the STAMP and place that data on OUTPUT pins in parallel fashion.
So, say a row in your 6x6 is ** on-off-on-off-on-off **, I would send that as an 8-bit word -- 00101010 ($2A). Likewise, if another row was ** on,on,on,off,off,on **, I would send 00111001 ($39)
I've fashioned the 6 pixels into an 8-bit word using 0's (as place-keeping) for the more significant bits.
When you receive that data with the STAMP, store it in a variable, and then "dump" it in parallel.
That much should give you a head start.
Lane
I am looking into the SERIN command, but am also looking for other possibilities.
I have at my disposal:
1. homework board that I can connect to a cpu at all time( I was thinking that this would be the BS2 that I would download the data to, then have it send out the on/off data to the other slave BS2's)
2. BOE board
3. 3 BS2 modules
4. my matrix consists of 36 120v realys with a control voltage of 4-32v connected to 36 120v halogen lights
Thanks for any reply,
Lane
I believe this is doable. You'll probably need the Darlington Array IC's, to provide enough current to drive the relays. And you could use fewer BS2's if you used 74HCT595 serial to parallel converters to provide the 'on-off' bits for the darlingtons. I'm not sure how fast you can turn on and off a halogen light, though, I thought they needed some 'heat-up' time.
The code is fairly simple. You'll still need the DATA statements in your VB program (or whatever you run on your PC). The BS2 code then just recieves the bytes, and sends them out the I/O pins.
Attached is a simple example of how to use VB to interface with the BS2 -- including a simple BS2 program to interface to VB.
I will take a look at what you sent me thatnk you so much for the quick response AllanLane5
Lane