oChaser4 Object

Back to top of page Description:
 The oChaser4 Object is used to control a series of four chasing lights.  It is capable of driving the four chasing lights at multiple speeds and multiple patterns.

The oChaser4 Object uses four digital I/O lines to communicate with four power drivers which handles the voltage and current requirements of the lights they are connected to.  The power drivers can be inverting or non inverting.

How fast the lights chase and in which direction is controlled by a single value with a range of -128 to +127.  When this value is 0, the lights are stopped.  When the value is a positive number from 1 to 127, the lights chase in a forward direction at the speed indicated by the value.  The higher the value, the faster the chase.  When the value is a negative number from -1 to -128, the lights chase backwards at the speed indicated by the value.  The lower the number, the faster the reverse chase.

 The following table lists the size and availability of the oChaser4 Object.
 ObjectSizeDescriptionA1A2B1B2C1
oChaser410 BytesControls a series of chasing lights.xx
Back to top of page Operation:
 The Operate property specifies if the chasing is on or off.  When the Operate property is set to 1 the chasing goes at the speed and direction indicated by the Speed property. When the Operate property is set to 0 the the chasing stops.  Note that whatever pattern was current at the time the Operate property switches to 0 will remain.  The output pattern used for the chase is determined with the Phasing property.  One of three different pattern can selected for the four lights and one pattern for three lights.  If the lights need to be turned off, the the Blank property can be set to 1.

When operating, a 0 in the Speed property will cause the chasing to be at a full stop. If the Speed property is greater than 0, then the DC Chasing will go forward at a speed specified by the Speed property. The higher the number (up to 127), the faster the chasing will turn. If the Speed property is less than 0, then the DC Chasing will go backwards at a speed specified by the Speed property. The lower the number (down to negative 128), the faster the chasing will turn in reverse.

When the Blank property is set to 1, all of the outputs will be set to off.  If the InvertOut property is set, then setting Blank will set all of the outputs to on.

The IOPack property selects which pack of four I/O lines will be connected to the light drivers.

Whether or not the light drivers are inverting or non-inverting can be selected with the InvertOut property.  If the drivers are non-inverting, then the InvertOut should be set to 0, If the drivers are inverting then it needs to be set to 1.

The BitShifter property is an instance of the oBitShifter object which is created when the oChaser4 object is.  The oChaser4 object configures the BitShifter object in such a way that it will do continuous shifts.  Attributes of the chasing operation can be adjusted by directly manipulating the BitShifter object. Note that doing so may change the way the chasing behaves to something different than the way described in this document.  (see oBitShifter object for more detail)

Back to top of page Properties:

The following table lists the properties of the oChaser4 Object:

Property

Description

Speed
A value that specifies how fast to the lights chase.
Object Class: oPower Value Range: -128 to 127
Data Type: Numeric Default Value: 0
SpeedDescription
-128Full Reverse
-64Half Reverse
0Stopped
64Half Forward
127Full Forward
IOPack
A value that specifies which pack of 4 I/O lines is connected to the Driver.
Object Class: oIOPack Value Range: 0 - 7
Data Type: Numeric Default Value: 0
Some I/O Lines have special purposes.  Be sure to see oIOPack help file for details.
Blank
A value that selects if the outputs are turned off.
Object Class: oSelect0to1L Value Range: 0 - 1
Data Type: Numeric Default Value: 0
Setting the Blank property to "0" leaves the outputs on while a setting of "1" turns the outputs off.

Blank

Lights

0Are on.
1Are off.
InvertOut
A value that selects if the outputs are inverted.
Object Class: oSelect0to1 Value Range: 0 - 1
Data Type: Numeric Default Value: 0
When InvertOut is 0 the lights are activated by a High logical output (5 Volts).  
When InvertOut is 0 the lights are activated by a Low logical output (0 Volts).  

InvertOut

Then the active outputs are:

0Active light lines are at 5 volts.
1Active light lines are at 0 volts.
Phasing
A value that selects the chasing pattern.
Object Class: oSelect0to3 Value Range: 0 - 3
Data Type: Numeric Default Value: 0
The phase pattern for the lights is set by the Phasing property.  Each time the lights chase, the next set in the Phase Pattern become active.
PhasingPhase PatternDescription
01 of the 4 lights is active while the other 3 are inactive.
12 of the 4 lights are active while the other 2 are inactive.
2Alternates between 1 and 2 active lights .  First: 2 of the 4 lights are active while the other 2 are inactive   Second: 1 of the 4 lights is active while the other 3 are inactive. 
3A similar pattern to Phasing 2 is used but with only 3 lights being used.
Operate
A value that selects whether or not the lights are chasing.
Object Class: oOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
Note that this is different than blanking the lights on and off which is controlled by the Blank property.
OperateConstantDescription
0cvOffThe lights are not chasing.
1cvOnThe lights are chasing.
Direction
A value that indicates the direction that the lights are chasing.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric (Read-Only) Default Value: 0
The Direction property is set based on the Speed property.  If the Speed property is a positive number, then Direction is set to 0. If the Speed property is a negative number, then the Direction property is set to 1.

Direction

Turn

Note that "forward" and "reverse" directions are dependant on the interface connection and the mounting of the lights.

0Forward
1Reverse
BitShifter
The I/O function object used to control the chasing lights.
Object Class: oBitShifter Value Range: 0 - 1
Data Type: Numeric Default Value: 0
When created, the oChaser4 Object sets the properties of the BitShifter to:
  • BitShifter.Rate to 64 as a base rate for the speed property.
  • BitShifter.Mode to 1 for a continuous shift.
Address
Returns a pointer to the address of the oCounter Object instance.
Object Class: oAddress Value Range: 0 - 127
Data Type:Pointer (Read Only) Default Value: Address of Object

Back to top of page Examples:
 In the following examples, the oChaser4 Object is used.
Visual Basic SyntaxC and Java SyntaxBasic Syntax
'This program controls
'the speed of chasing 
'lights with the input
'from an A2D converter 

Dim C As New oChaser4
Dim A As New oA2DX

Sub main()
  A.IOLine = 2
  A.Operate = 1
  C.IOPack = 1
  C.Operate = 1
  Do
    C.Speed = A.Value
  Loop
End Sub
//This program controls
//the speed of chasing 
//lights with the input
//from an A2D converter 

oChaser4 C = New oChaser4;
oA2DX A = New oA2DX;

Void main(Void){
  A.IOLine = 2;
  A.Operate = 1;
  C.IOPack = 1;
  C.Operate = 1;
  Do{
    C.Speed = A.Value;
  } While (1)
}
'This program controls
'the speed of chasing 
'lights with the input
'from an A2D converter 

C As oChaser4
A As oA2DX(2,,cvOn)

C.IOPack = 1
C.Operate = 1

1: C.Speed = A.Value
Goto 1
Back to top of pageConnections:
If the lights used draw any more current than 25ma or operate at more than 5 Volts, then a driver will need to be used.

The L293D is a driver that can be used.  The IOPack property specifies which four I/O Lines to connect.

L293D Driver and 4 lights.
IOPack:1234567Light
I/O 0:8162451220281st
I/O 1:9172561321292nd
I/O 2:10182671422303rd
I/O 3:111927-1523314th

Back to top of page Related Items:

 The following table lists objects with related functions
 ObjectDescriptionA1A2B1B2C1
o8barControls an 8-Segment Bar Display.x
oLEDControls an LED light with brightness control.xxx
oLEDBControls an LED light with blinking functions.xx
oLightControls a light.xxx
Back to top of page Version History and Bug List:
 Firmware Ver B2: Introduced.

Bugs: No known bugs.


ooPIC Compiler Ver 6.0 (c) Copyright 1997 - 2007 Savage Innovations, LLC.