oPWML Object

Main Index
Object List
Back to top of pageDescription:
 

A Hardware Object that provides a low-speed clocked output with a variable sized pulse width.

 The following table lists the size and availability of the oPWML Object.
 ObjectSizeDescriptionA1A2B1B2C1
oPWML4 BytesProvides a low-speed Pulse-Width-Modulated output on any I/O line.xxx
Back to top of pageOperation:
 An oPWML Object outputs a Pulse-Width-Modulated clock cycle on the I/O line specified by the IOLine property.

The output clock cycles at a frequency of about 550 Hz.  The Pulse-Width of the logic-high portion of the clock cycle output is determined by the value of the DutyCycle property which is expressed as ratio of an 4-Bit number where 7 would be 50%

The Operate property specifies if the logic-high portion of the clock cycle output is generated.  When the Operate property is set to 1, the oPWML Object starts generating and outputting the PWM clock cycle. When the Operate property is set to 0, the PWM pulses are discontinued and the specified I/O Line is set to 0-Volts.

Back to top of pageProperties:

The following table lists the properties of the oPWML Object:

Property

Description

DutyCycle
A value that specifies the duty cycle of the PWM output.
Object Class: oNib Value Range: 0 - 15
Data Type: Numeric Default Value: 0
DutyCycleOperatePulse WidthOutput
Any00
0Any0
3125%
7150%
11175%
15*
 (see history)
1100%
*Bug: A value of 15 does not work in firmware B1 to B2.  Fixed in C1.
IOLine
A value that specifies which PWM I/O Line is used to output the PWM.
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.
Invert
A value that selects if the output is inverted.
Object Class: oSelect0to1L Value Range: 0 - 1
Data Type: Numeric Default Value: 0
Availability: Added in Firmware C1
OperateConstantDescription
0cvOff

The PWM pulse is a high (5 Volt) going pulse.

1cvOn

The PWM pulse is a low (0 Volt) going pulse.

Operate
A value that selects whether or not the PWM is outputted.
Object Class: oOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OperateConstantDescription
0cvOff

The PWM signal remains Low.

1cvOn

The PWM signal outputs a high pulse with a Duty Cycle determined by the DutyCycle property.

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 pageExamples:
In the following example, the oPWML Object is used.
Visual Basic SyntaxC and Java Syntax
'This program causes 
' I/O Line 17 To 
' output a PWM signal.
' with a Duty Cycle
' that changes.

Dim A As New oPWML

Sub Main()
  A.IOLine = 31
  A.Operate = 1
  Do
    A.DutyCycle.Inc
    Delay = 10
  Loop
End Sub
//This program causes 
// I/O Line 17 To 
// output a PWM signal.
// with a Duty Cycle
// that changes.

oPWML A = New oPWML;

Void Main(Void){
  A.IOLine = 31;
  A.Operate = 1;
  Do{
    A.DutyCycle.Inc;
    Delay = 10;
  }
}
Basic Syntax 
'This program causes 
' I/O Line 17 To 
' output a PWM signal.
' with a Duty Cycle
' that changes.

A As oPWML(31,,,cvOn)

Do
  A.DutyCycle.Inc
  Delay = 10
Loop
 

Back to top of page Related Items:

 The following table lists objects that use the oPWML Object.
 ObjectDescriptionA1A2B1B2C1
oLEDControls an LED light with brightness control.xxx
oLightControls a light.xxx
The following table lists other objects with related functions.
 ObjectDescriptionA1A2B1B2C1
oPWMHOutputs a high-speed Pulse-Width-Modulated output using hardware specific I/O lines.xxxxx
oPWMSOutputs a RC-Servo timed Pulse-Width-Modulated output on any I/O line.xxxxx
Back to top of page Version History and Bug List:
 Firmware Ver B1: Introduced.
Firmware Ver C1: Invert property added.

Bugs: Firmware B1 to B2 a DutyCycle of 15 does not work.  Fixed in firmware C.1


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