oPWMH Object

Main Index
Object List
Back to top of pageDescription:
 

An Object that provides a high-speed Pulse-Width-Modulated output using hardware specific I/O lines.

The following table lists the size and availability of the oPWMH Object.
 ObjectSizeDescriptionA1A2B1B2C1
oPWMH3 ByteAn Object that controls the PIC's oPWMH Hardware Module.xxxxx

Back to top of pageOperation:
 

An oPWMH 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 19.6khz.  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 8-Bit number where 127 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 PIC's PWM Module starts generating PWM pulses. When the Operate property is set to 0, the PWM pulses are discontinued and the specified I/O Line is set to 0-Volts.

The oPWMH Object uses an instance of the oPWM object which it uses to generate the Pulse-Width-Modulated output.  Note that all other objects that use the oPWM object will share the PIC's PWM Hardware.  Most properties of the oPWM instance can be adjusted and will affect the oPWMH object's operation such as PWM.PreScale which is used to specify the frequency of the output clock cycle.    (see oPWM Object for more detail) 

Back to top of pageProperties:
 

The following table lists the properties of the oPWMH Object:

Property

Description

DutyCycle
A value that specifies the duty cycle of the PWM output.
Object Class: oByte Value Range: 0 - 255
Data Type: Numeric Default Value: 0
This is the count at which the PWM output switches state to 0.
DutyCycleOperatePulse WidthOutput
Any00
0Any0
63125%
127150%
191175%
2551100%
IOLine
A value that specifies which PWM I/O Line is used to output the PWM.
Object Class: oIOLineP Value Range: 0 - 1
Data Type: Numeric Default Value: 0 (18)
IOLineDescription
0

The PWM signal is output on IOLine 18. 18 can be assigned to the IOLine in place of 0 but it will read back as 0.

1

The PWM signal is output on IOLine 17. 17 can be assigned to the IOLine in place of 1 but it will read back as 1.

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 and the Period property.

PWM
The PIC Hardware object used to output the PWM signal.
Object Class: oPWM Value Range: 0 - 256
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 pageExample:

 In the following example, the oPWMH 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 oPWMH

Sub Main()
  A.IOLine = 17
  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.

oPWMH A = New oPWMH;

Void Main(Void){
  A.IOLine = 17;
  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 oPWMH(17,,cvOn)

Do
  A.DutyCycle.Inc
  Delay = 10
Loop
 

Back to top of pageRelated Items:

 The following table lists other objects with related functions.
 ObjectDescriptionA1A2B1B2C1
oPWMLOutputs a low-speed Pulse-Width-Modulated output on any I/O line.xxx
oPWMSOutputs a RC-Servo timed Pulse-Width-Modulated output on any I/O line.xxxxx
Back to top of pageVersion History and Bug List:
 Firmware Ver A1: Introduced.

Bugs: No known bugs.


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