X-Treme Serial Control
X-Treme Serial Control was designed using Microsoft Visual Basic version 6. The interface as shown below provides a simple point and click method for controlling up to 4 individual relays attached to the PC serial port.
Using the Basic Stamp I or the Basic Stamp II to talk to your PC you can control up to 4 relays with our new interface software.
Click HERE to download the software NOW...!
When you start the X-Treme Serial Control software for the first time, you're asked to select a com port and the baud rate. Once you have selected the com port and baud rate to use, the main screen as shown above will be displayed. The drop-down settings menu lets you save your default settings for the com port and baud rate. You never need to select the com port or baud rates to use again unless you need to change them. X-Treme Serial Control remembers your default settings and reloads them each time you start the software.
To turn ON a relay simply click on the buttons marked #1-#4. The relays attached to your Basic Stamp or other microcontroller will be turned ON/OFF. The green POD areas of the interface will provide you with a visual indication of each relays status. If the relay is ON, the POD area will indicate the ON/OFF status and which relay is ON/OFF. As shown above, relays #1,#2,#3 and #4 are all ON.
When you close the X-Treme Serial Control software, it remembers the last state of each individual relay. When you start the X-Treme Serial software the next time, it will send the stored status for each relay back out the serial port. Each pod area will also be the same as it was when you exited the software. This allows you to reset each relay after a power failure or other problem.
The switches on the interface will actually toggle back and forth just like a real toggle switch. When you press and hold the mouse button over a switch it moves to the right. When you release the mouse button the switch will return to the left side position and the POD area will reflect the change of state and output # for the relay.
X-Treme Serial Control comes with a built-in timer that allows you to pre-set the time for each of the 4 relays to switch ON/OFF. The following screen capture shows the timer setup screen.
As shown above, it's simple to setup timers for each of the 4 controlled relays. The time for each relay to switch ON or OFF is typed into the areas that correspond to each of the 4 outputs. Output #1 and Output #2 are active as shown above. The red X on the clock icon indicates that the output has not been selected. Simply click the button next to an output once you have pre-set the ON/OFF times for that output. When you close the timer setup screen, X-Treme Serial will remember the pre-set times and send the information out to the Basic Stamp or other microcontroller to turn ON/OFF the selected outputs or relays at the pre-set times.
This feature allows unattended operation of all 4 relays much the same as any other programmable controller, but without the need for the onboard time clock and extra programming normally associated with a programmable microcontroller timer product.
With the ability to control up to 4 individual relays at pre-set times, the possibilities are endless. Here are just a few examples:
You name it, anything you can switch with a simple relay can be controlled with X-Treme Serial Control. The built-in timer programming option uses the PC time clock and will operate each of the 4 relays attached to your PC with the same precision as your PC time clock.
The Basic Stamp Code:
The following is a simple code example for using X-Treme Serial Control software with the Basic Stamp I single board computer from Parallax. The Basic Stamp single board computers are a must have for beginners that want a fast microcontroller platform for quick & easy product development.
symbol relay = b3 ' Variable storage for relay# symbol stat = b4 ' Variable storage for relay status ON/OFF 1=ON, 0=OFF read 0,stat ' On boot retrieve relay ON/OFF state pin0 = stat ' Restore the output read 1,stat pin1 = stat read 2,stat pin2 = stat read 3,stat pin3 = stat
loop: serin 7,N2400,(254),relay,stat ' Receive serial data from X-Treme Serial Control if relay = 1 then out0 ' on pin #7 of the Basic Stamp. if relay = 2 then out1 ' You can change the serial input pin to any pin if relay = 3 then out2 ' you want to use. Make sure to change the output if relay = 4 then out3 , pin# assignments below if you change the input pin# goto loop ' if relay = 1 means that if the value held in variable storage location B3 = 1 ' then jump to the routine out0. The remaining lines are similar in function. out0: write 0,stat ' First we use the write command to record the if stat = 1 then high0 ' ON/OFF state, a logic 1 (high), or a logic 0 (low) low 0: goto loop ' for each output. After writing these values to high0: ' the Basic Stamp EEPROM we then set or clear each high 0:goto loop ' output pin to control the relays. out1: write 1,stat if stat = 1 then high1 low 1: goto loop high1: high 1: goto loop out2: write 2,stat if stat = 1 then high2 low 2: goto loop high2: high 2: goto loop out3: write 3,stat if stat = 1 then high3 low 3: goto loop high3: high 3: goto loopAbove is the simple code for using X-Treme Serial Control with the Basic Stamp I. To use the Basic Stamp II with X-Treme Serial, you need to make a few simple adjustments to the code. Below is the basic code to use with the BS2.
' Using the BSII with X-Treme Serial Control ' Visual Basic Software to Control 4 Relays.
relay var b3 'relay number storage variable stat var b4 'relay status ON/OFF variable baud con 16468 '9600,N,8,1 serpin con 0 'serial I/O pin = 0 loop: serin serpin,baud,[wait(254),relay,stat] 'serial data in on pin0 if relay = 1 then outr1 ' if request is for relay#1 then goto relay#1 routine if relay = 2 then outr2 ' if request is for relay#2 then goto relay#2 routine if relay = 3 then outr3 ' if request is for relay#3 then goto relay#3 routine if relay = 4 then outr4 ' if request is for relay#4 then goto relay#4 routine goto loop outr1: if stat = 1 then high1 ' If status request is I/O pin#1 logic 1 [high] low 1: goto loop ' then make I/O pin#1 high, else make it [low] high1: high 1: goto loop ' Make I/O pin#1 logic 1 [High] outr2: if stat = 1 then high2 low 2: goto loop high2: high 2: goto loop outr3: if stat = 1 then high3 low 3: goto loop high3: high 3: goto loop outr4: if stat = 1 then high4 low 4: goto loop high4: high 4: goto loop
Notice that the code for the BS2 doesn't include the read & write statements. This was done on purpose to show you how to do it both ways. Not every one will want to record the relay ON/OFF status to EEPROM.
Also take note that each code segment will wait until the number 254 is received before it accepts any more serial data. This method helps to make sure we don't receive line noise that could possibly cause erratic behavior. It also helps us to synchronize the serial data to the incoming data stream by not allowing us to pick up data in the middle of the data stream. The program will wait until 254 "the synch byte" is received. Without this technique, it would be possible to receive serial data from the incoming data stream that would be out of synch and cause erratic behavior.
How to Hookup Relays:
The picture below shows how to hookup relays to the Basic Stamp I or II. The 22K resistor limits the current to acceptable levels and allows you to directly interface to the PC serial port without needing an RS232 driver IC like the Maxim MAX232. Take note of the actual Basic Stamp code in the above samples. If the X-Treme software sends out a request to Turn ON one of the relays, the state of the output pin on the Basic Stamp will go to a logic 1 or (high) state. This will then Turn ON the NPN transistor shown in the picture below.
When the X-Treme software sends the data (0) a logic low to Turn OFF an associated output, the NPN transistor will be turned OFF. You can simply change the output commands in the Basic Stamp code to act just the opposite if you like and then use PNP transistors to activate your relays when a (0) is received from the X-Treme software.
Using the Windows 98 Task Scheduler:
If you're using Windows 98, you can setup the Windows Task Scheduler to start X-Treme Serial Control at a pre-determined time each day to activate or deactivate the relays attached to your PC.
NOTE: Using the task scheduler will only restore each output to the state indicated on-screen. It does not re-open any timer settings. Timer settings are only valid while the software is running. When you close X-Treme Serial, all timer settings are lost.
To use timer settings, you must keep X-Treme running.
FREE 14-Day Trial
You can download X-Treme Serial Control software below. It will expire after 14-day's. If you decide to continue using the software, you'll need to download the unlock code generator HERE.
We're offering the unlock code for free now, so download the unlock code generator above if you plan to continue using the software. If the unlock code generator will not run on your system, just drop us an email with your full name, and we'll generate it for you.
Click HERE to download the X-Treme Serial Control Software with a FREE 14-Day trial.
Looking for Complete PicBasic Projects...?