oCycleTimeH Object

Main Index
Object List
Back to top of page Description:
 Measures the cycle time of a high-frequency input on a hardware specific I/O line.
 The following table lists the size and availability of the oCycleTimeH Object.
 ObjectSizeDescriptionA1A2B1B2C1
oCycleTimeH4 BytesMeasures the cycle time of a high-frequency input using a hardware specific I/O line.x
Back to top of page Operation:
 

When the Operate property is 1, the oCycleTimeH Object monitors I/O line 17 for a specified transition.  When the input transitions, a counter value is copied to the Duration property and the counter is reset to 0.

The Mode property selects the transition that causes the copy which can be one of the following:

  • Every falling edge

  • Every rising edge

  • Every 4th rising edge

  • Every 16th rising edge

When the transition occurs, the 16-bit value of the counter is copied into the Value property.  If another transition occurs before the Value property is read, the old value is overwritten by the new value.  Note that any changes to the mode property only take affect when the operate property transitions from 0 to 1.

The DIO property is an instance of the oCCP object which is used to do the actual cycle time calculation.  When the operate property transitions from 0 to 1, the oCCP object is configured so that it will use an oTimer object with an internal clock and a 1:1 prescale.   Note that all instances of the oTimer object will use the PIC's Timer1 Hardware Module.  Therefore, all instances of the oTimer object and objects that use the oTimer object will have the same 16-Bit count.  

Back to top of page Properties:

The following table lists the properties of the oCCP Object:

Property

Description

Duration
A value that indicates the current duration of one cycle.
Object Class: oWord Value Range: 0 - 65535
Data Type: Numeric Default Value: 0
Mode
A value that selects how the cycle time is measured.
Object Class: oSelect0to3 Value Range: 0 - 3
Data Type: Numeric Default Value: 0
Any changes to this property will be ignored until the operate property transitions from 0 to 1.
PreScaleDescription
0Every falling edge
1Every rising edge
2Every 4th rising edge
3Every 16th rising edge
Operate
A value that selects whether or not the cycle time is measured.
Object Class: oOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OperateConstantDescription
0cvOffThe cycle time  is not measured.
1cvOnThe cycle time is measured.
IOLine
I/O Line 17 used as the input line.
Object Class: oIOLine Value Range: 17
Data Type: Numeric (Read-Only) Default Value: 17
DIO
The PIC Hardware object used to measure the cycle time.
Object Class: oCCP Value Range: 0 - 65535
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 oCycleTimeH Object is used.
Visual Basic SyntaxC and Java Syntax
' This program measures the cycle
' time on I/O Line 17 and displays
' the result on I/O Group 1 and 3.

Dim C As New oCycleTimeH
Dim D As New oDIO16

Sub main()
  C.Mode = 1
  C.Operate = 1
  D.Direction = cvOutput
  Do
    D.State = C.Duration 
  Loop
End Sub
// This program measures the cycle
// time on I/O Line 17 and displays
// the result on I/O Group 1 and 3. 

oCycleTimeH C = New oCycleTimeH;
oDIO16 D = New oDIO16;

Void main(Void){
  C.Mode = 1;
  C.Operate = 1;
  D.Direction = cvOutput;
  Do{
    D.State = C.Duration;
  } While (1);
}
Basic Syntax 
' This program measures the cycle
' time on I/O Line 17 and displays
' the result on I/O Group 1 and 3.

C Var oCycleTimeH(1,cvOn)
D Var oDIO16(cvOutput)

Do
  D.State = C.Duration 
Loop
 

Back to top of page Related Items:

 The following table lists objects with related functions
 ObjectDescriptionA1A2B1B2C1
oCycleTimeLMeasures the cycle time of an low-frequency input on any I/O line.xxx
Back to top of page Version History and Bug List:
 Firmware Ver C1: Introduced.

Bugs: No known bugs.


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