oSpeedOMeter Object

Main Index
Object List
Back to top of page Description:
 An Object that reads a Speedometer.
 The following table lists the size and availability of the oSpeedOMeter Object.
 ObjectSizeDescriptionA1A2B1B2C1
oSpeedOMeter6 BytesReads a Speedometer.xxx
Back to top of page Operation:
 

The oSpeedOMeter Object handles all the necessary I/O timing requirements to read a speedometer.

The oSpeedOMeter Object monitors the I/O line specified by IOLine property.  As long as the Operate property is 1, the oSpeedOMeter Object will continually update its Speed property.  The Speed property is updated each time a new high-going pulse is received from the Speedometer. 

When the speedometer's axel is turning, the Speed property is set to a value from 1 to 255 which indicates the Speed and the Turning property is set to 1.  As the rate of turn increases, the value of the Speed property increases. When the Speedometer's axel is not turning, or is turning at less than 1 round per second, the Speed and the Turning properties will be set to 0.

The Speed property is calculated from the following formula: Speed = (256 - (283 / RevolutionsPerSecond))
Inversely, the Revolutions-Per-Second can be calculated from the Speed: RevolutionsPerSecond = (283 / (256-Speed))

Note that the Speed is not linear.  As the Revolutions-Per-Second goes up, the Speed property increases at a quicker rate.  Thusly, while the the oSpeedOMeter Object is capable of measuring up to 283 Revolutions-Per-Second, it is best at measuring less than 5 Revolutions-Per-Second.  (See Speed property table)

The Timer property is an instance of the oCycleTimeL object which is created when the oSpeedOMeter Object is.  The oSpeedOMeter Object uses the timer object to read the signal generated by the Speedometer.  Modifying any of the properties of the oCycleTimeL instance will affect the oSpeedOMeter Object's operation.  See the oCycleTimeL Help for more detail on how the oSpeedOMeter reads the Speedometer's signal.

Back to top of page Properties:

The following table lists the properties of the oSpeedOMeter Object:

Property

Description

Speed
A value that indicates the Speed that the speedometer's axel is turning.
Object Class: oByte Value Range: 0 - 255
Data Type: Numeric Default Value: 0
The Speed is determined using the following formula: Speed = [256 - (283 / RevolutionsPerSecond)
SpeedDescription
0The axel is turning slower than 1.1 revolution per second.
1The axel is turning 1.105 revolutions per second.
2The axel is turning 1.110 revolutions per second.
3-252The axel is turning between 1.110 and 93.33 revolutions per second.
253The axel is turning 93.33 revolutions per second.
254The axel is turning 141 revolutions per second.
255The axel is turning 383 revolution per second or faster.
Turning
A value that indicates that the speedometer's axel is turning.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OperateConstantDescription
0cvFalseThe axel is not turning.
1cvTrueThe axel is turning.
IOLine
A value that specifies which I/O Line is connected to the Speedometer.
Object Class: oIOLine Value Range: 0 - 31
Data Type: Numeric Default Value: 0
Some I/O Lines have special purposes.  Be sure to see oIOLine help file for details.
Operate
A value that selects whether or not the Speedometer is being read.
Object Class: oOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OperateConstantDescription
0cvOffThe properties are not updated.
1cvOnThe properties are updated.
Timer
The I/O function object used to read the Speedometer.
Object Class: oCycleTimeL Value Range: 0 - 255
Data Type: Numeric Default Value: 0
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 example, the oSpeedOMeter Object is used.
Visual Basic SyntaxC and Java Syntax
'This program reads how fast 
'an axel is turning with an  
'oSpeedOMeter Object and 
'outputs the value as a tone

Dim A As New oSpeedOMeter
Dim B As New oSpeaker
Dim C As New oDIO1

Sub Main()
  A.IOLine = 15
  A.Operate = cvTrue
  B.Operate = 1
  C.IOLine = 8
  C.Direction = cvOutput
  Do
    B.Tone = A.Speed * 250
    C.State = A.Turning
  Loop
End Sub 
//This program reads how fast 
//an axel is turning with an  
//oSpeedOMeter Object and 
//outputs the value as a tone

oSpeedOMeter A = New oSpeedOMeter;
oSpeaker B = New oSpeaker;
oDIO1 C = New oDIO1;

Void Main(Void){
  A.IOLine = 15;
  A.Operate = cvTrue;
  B.Operate = 1;
  C.IOLine = 8;
  C.Direction = cvOutput;
  Do{
    B.Tone = A.Speed * 250;
    C.State = A.Turning;
  } While (1)
}
Basic Syntax 
'This program reads how fast 
'an axel is turning with an  
'oSpeedOMeter Object and 
'outputs the value as a tone

A As oSpeedOMeter
B As oSpeaker(0,cvOn)
C As oDIO1(8,cvOutput)

A.IOLine = 15
A.Operate = cvTrue

Do
  B.Tone = A.Speed * 250
  C.State = A.Turning
Loop
 
Back to top of page Connections:
The oSpeedOMeter uses the single I/O line specified by the IOLine property.  The I/O line can be any 1 I/O line of the ooPIC's 31 I/O lines as long as it is not being used by another function.  As shown, a magnetic reed switch is used in conjunction with a rotating axel with a magnet mounted on one side.  Each time the axel rotates one revolution, the reed switch will close, and the oSpeedOMeter will calculate a new Speed value.

Note that a rotational speed of less than once per second will result in a Speed value of 0.   If the wheel is revolving at less than this speed, the sensor needs to be mounted somewhere in the gearing or multiple magnets need to be used.

Back to top of page Related Items:

 The following table lists objects with related functions
 ObjectDescriptionA1A2B1B2C1
oFeedBack1TMeasures the time interval between a signal sent on one I/O line and returned on a second I/O line.xxx
Back to top of page Version History and Bug List:
 Firmware Ver B1: Introduced.

Bugs: No known bugs.


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