oTone Object
An Object that outputs a tone.
Description:
 

A Hardware Object that generates and outputs a low frequency tone.

Operation:
 

When the Operate property is 1, the oTone Object cycles the I/O line specified by the IOLine property at a rate specified by the Value property.  

The Frequency of the tone is derived from a 1,132kHz clock divided by 128 minus the Value property. [1132/(128-Value)]  For example, a value of 120 will produce a 141.5Hz Tone. [(1132/(128-120)) = 141.5]

Remarks:
Two or more oTone Objects can be set to the same I/O line.  When this is done, the cycles of the multiple tones are combined.

The oTone Object's output shares its timing with the rest of the OOPic's multitasking objects.  A large number of Objects running concurrently with the oTone Object can result in distortions on the higher frequency tones.

Storage size & Availability:
 

The following table lists the size and availability of the oTone Object and its variations:

ObjectSizeVersion
oTone 5 Bytes B.1.0
Properties:
 

The following table lists the Properties of the oTone Object:

Property Description
Address

Returns a pointer to the address of the oTone Object instance.

Data-Type: Address, Read-Only

Data-Range: 0 - 127

IOLine

A value that specifies the physical I/O Line to use.

Data-Type: Byte

Data-Range: 0 - 31

Operate

A value that specifies whether or not the I/O line is cycled.

Data-Type: Bit, Flag

Data-Range: 0 - 1

Value

A value that specifies the cycle rate of the tone.

Data-Type: Byte, Default

Data-Range: 0 - 127

Example:
  In the following examples, the oTone Object is used.
' Produce an alarm every 
'  two seconds.

Dim T As New oTone

Sub Main()
  T.IOLine = 21
  Do
    Call Alarm
    OOPic.Delay = 200
  Loop
End Sub

Sub Alarm()
  T.Operate = 1    
  Do 5 Times
    T.Value = 120
    OOPic.Delay = 3
    T.Value = 117
    OOPic.Delay = 3
  Loop
  T.Operate = 0
End Sub
' Combine 2 tones

Dim T As New oTone
Dim G as new oTone

Sub Main()
  T.IOLine = 21
  T.Value = 113
  T.Operate = 1
  G.IOLine = 21
  G.Value = 127
  G.Operate = 1
  do 
    OOPic.Delay = 15
    G.Operate = 0
    OOPic.Delay = 15 
    G.Operate = 1
    G = G - 1
  loop
End Sub
See Also:
 

oClock - An Object that provides a programmable logic clock
oFreq - A Hardware Object that generates and outputs a high frequency tone.