Bs2 serial communication
It is able to control and monitor timers, keypads, motors, sensors, switches, relays, lights, and more. All vital components processor, clock source, memory, power regulator are provided on the BS2's tiny PCB; just connect power and go!
The BS2-IC is widely used in educational, hobby, and industrial applications and is strongly recommended for first-time BASIC Stamp users because of plentiful resources documentation, source code, and customer projects that are available online and in print.
Our Stamps in Class Educational Program was designed with this module, making it a great place to learn about microcontrollers. When data is read it sets the LED on pin 13 high and delays a bit.
The BS2 is looping forever sending a the byte It never works. I made sure to upload the Arduino program, disconnect USB and go on 9V battery power, tried the SoftwareSerial library on pins 2 and 3, even changed the BS2 pins as well. Can anyone point me in the right direction?? I always put a 3. That's BS2 pin 3 to ground. This usually cures the unwanted "reset" problem. It lowers the pin's input impedance from 20k down to 3k and filters short spikes.
A capacitor in series with ATN can still be used to reset or wake up the system. This note deals with several issues that arise in implementing the serial port. A lot of this material is not explained at all in the Stamp manuals, especially the timing issues. Difficulties with timing on the serial ports can be one of the most frustrating aspects of developing stamp applications.
It usually comes down to quantitative questions of how fast data can be received, recognized, processed and transmitted. Flow control is useful when two BS2 stamps have to talk to one another, so that one talks only when the other is ready to listen.
This flow control can be combined with timeouts to implement a system where both stamps can be busy doing something else most of the time. Those stamps can then communicate, despite the stamp's lack of interrupts or a serial port buffer. The interface takes an extra wire for the flow control, but the code requirements on the stamp end are minimal. The flow control is also useful when the stamp has to send data to a desktop PC or peripheral. P15 is an output, resting at a low level.
P14 is an input. So long as p14 is low, the serout command pauses and does not send anything. But when p14 goes high, then the serout command sends data letter A. It first sends the start bit, a high level, and the bits of the ascii code 65, lsb first, and then a level low stop bit.
If p14 is still high, the serout command immediately sends the letter B. If p14 is low, it waits until p14 goes high again to send the letter B. The delay from the time p14 goes high to the leading edge of the start bit is about 10 microseconds. Once the start bit is sent, the serout command is committed to send the entire byte, regardless of the status of pin This differs from the above because the polarity is reversed.
The data pin p15 rests at a high level, and the flow is paused so long as the level on flow pin p14 is also high. But when p14 goes low, the byte transmission starts about 10 microseconds later. Another variation:. But if p14 does not go low within 6 seconds, the command times out and branches to the label "bailout". Here is another variation, this time using the system serial port on physical pins 1 and 2, addressed as p The system serial port has a built-in inverter and rests at a low -5 volts level.
It waits until input p14 goes high before sending the data, "A". Data flow is enabled so long as p14 is high and it it inhibited if p14 is low. If p14 does not go high within one minute, the command times out and branches to the label "bailout". On regular pins, the baudmode affects the sense of both the flow control pin and the data pin; on the system port p16 only the sense of the flow control is affected.
The connection of RTS to p14 via a protection resistor prevents overflow of the HPLX input buffer when transferring large amounts of data. This is more of a concern when using the BS2SX with its much faster processor. When the BS2 encounters a serin instruction, it sets the level on fpin to "ready". As soon as it detects an incoming character, it sets fpin back to "not ready", so that the device that is sending data will not pile up characters end to end.
If the one serin instruction has to receive several bytes, you will see the fpin blip back and forth several times. When the serin instruction is finished execution, the fpin is left in the "not ready" state. Thus further data transmission is quenched until another serin instruction is ready for it. Your program can go off and do something with the data and then come back to get more without danger of losing characters.
When the program hits this command, p14 is set low automatically by the BS2 to signal to the external device that the command is ready to receive data. The external device should then send the start bit a low level followed by the data that is put into the variable zork. This is usefull if you want to see the temperature in large easy to read letters. These 8 custom characters are user defined and can be used how ever the user sees fit.
You will have to note, that you cannot use Large Digits, Bar Graps or user defined Custom Characters at the same time. It has to be one or the other. In this code, the LCD will display 10 medium digits, starting with 0 and going to 9. This code is usefull for the digital thermometer we will be building next.
This Applications note shows how easy it is to utilize large digits that are built into Matrix Orbital displays using I2C communication. Our Alphanumeric displays have the ability to display large digits. Large digits is a combination of the 8 custom characters an alphanumeric display has. In this example we are talking to a display at address 80 Decimal 50 hex over I2C communication protocol. In this code, the display will display 10 large digits, starting with 0 and going to 9.
This Applications note shows how easy it is to utilize large digits that are built into Matrix Orbital displays using serial communication.
0コメント