When the Operate property is 1, the oPulseTimeH Object monitors I/O line 17 for a specified pulse. When the pulse is started, a counter value reset and when the pulse ends, the counter value is copied to the Duration property.
The State property selects whether the pulse being measured is a high-going or low-going pulse.
The Timer property is an instance of the oCCP object which is used to do the actual pulse 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.
Note: oCCP object uses an instance of the oTimer object. All instances of the oTimer object use the same PIC hardware, Therefore all instances of the oPulseTimeH objects will read the same 16-Bit value. Also note that setting its properties can affect the way the oPulseTimeH operates.
Address
Returns a pointer to the address of the oCounter Object instance.
In the following example, the oPulseTimeH Object is used.
Visual Basic Syntax
C 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 oPulseTimeH
Dim D As New oDIO16
Sub main()
C.State = 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.
oPulseTimeH C = New oPulseTimeH;
oDIO16 D = New oDIO16;
Void main(Void){
C.State = 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 oPulseTimeH(1,cvOn)
D Var oDIO16(cvOutput)
Do
D.State = C.Duration
Loop