oConverter Object

Back to top of page Description:
 A Processing Object that converts one value to another in one of 4 predefined commonly used ways. Some of the value conversions emulate the functions of common integrated circuits.
 The following table lists the size and availability of the oConverter Object.
 ObjectSizeDescriptionA1A2B1B2C1
oConverter3 BytesProvides conversion functions.xxxxx
oConverterC5 BytesProvides conversion functions.xxx
Back to top of page Operation:
 

An oConverter Object takes the Value from the Object that the Input property points to and converts it to another value in a manner specified by the Mode property then stores that value in the object pointed to by the Output property.

The conversions include: binary to decimal binary to 7-Segment display binary to Sine and binary to stepper-motor phase.

Back to top of page Property Options:
 The oConverter Object has 2 variants which are selected with the property option C.
  • C specifies that a clocked version of the object is used.
Continuous
operation
Clocked
operation
oConverteroConverterC
Back to top of page Properties:

The following table lists the properties of the oConverter Object:

Property

Description

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

The Output Objects Value is not updated.

1cvOn

The Output Objects Value is updated.

Input
A pointer to an object that holds the value to be converted.
Object Class: oValuePtrI Value Range: Any oValue Object
Data Type: Pointer Default Value: Null
Output
A pointer to an object whose value will be updated with the converted value.
Object Class: oValuePtrO Value Range: Any oValue Object
Data Type: Pointer Default Value: Null
InvertOut
A value that selects if the bits of the converted value are inverted before stored in the Output object.
Object Class: oSelect0to1L Value Range: 0 - 1
Data Type: Numeric Default Value: 0
InvertOutDescription
0

The converted value is written to the Output Object.

1

The bits of the converted value are inverted before written to the Output Object.

Mode
A value that selects which one of 4 conversion types to performed.
Object Class: oSelect0to3 Value Range: 0 - 3
Data Type: Numeric Default Value: 0
ModeConstantDescription
0cv7Seg

Binary to/from 7 Segment display.

1cvPhase

Binary to 8-Phase Stepper-Motor.

2cvSin

Binary to/from Sine. This can also be done in program code with the sin Function.

3cvDecimal

Binary to/from Decimal. Same as (74150 IC).
I.E. Binary:011 = Decimal:00000100
and Binary:111 = Decimal:10000000

Blank
A value that selects if the bits of the converted value are cleared before stored in the Output object.
Object Class: oSelect0to1L Value Range: 0 - 1
Data Type: Numeric Default Value: 0
BlankDescription
0

The Output Object is updated with the converted information.

1

The Output Object's bits are all set to 0.

Process
Clock
See Clocked Objects for detail
Object Class: oClockedOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
Availability: oConverterC
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 oConverter Object is used
Visual Basic Syntax C and Java Syntax
'This program creates a Virtual Circuit 
'that uses the oConverter Object to
'convert the value in B to 7-Segment 
'LED coding and then outputs that on 
'I/O lines 24 - 31

Dim A As New oConverter
Dim B As New oByte
Dim D As New oDIO8

Sub Main()
  A.Input.Link(B)
  A.Output.Link(D)
  A.Operate = 1
  A.InvertOut = 1
  D.IOGroup = 3
  D.Direction = cvOutput
  Do
    ooPIC.Delay = 25
    B = B + 1
  Loop
End Sub
'This program creates a Virtual Circuit 
'that uses the oConverter Object to
'convert the value in B to 7-Segment 
'LED coding and then outputs that on 
'I/O lines 24 - 31

oConverter A = New oConverter;
oByte B = New oByte;
oDIO8 D = New oDIO8;

Void Main(Void){
  A.Input.Link(B);
  A.Output.Link(D);
  A.Operate = 1;
  A.InvertOut = 1;
  D.IOGroup = 3;
  D.Direction = cvOutput;
  Do{
    ooPIC.Delay = 25;
    B = B + 1;
  } While (1)
}
Basic Syntax 
'This program creates a Virtual Circuit 
'that uses the oConverter Object to
'convert the value in B to 7-Segment 
'LED coding and then outputs that on 
'I/O lines 24 - 31

A As oConverter(,,1,,,1)
B As oByte
D As oDIO8(3,cvOutput)

A.Input.Link(B)
A.Output.Link(D)

Do
  Delay = 25
  B = B + 1
Loop
 

Back to top of page Related Items:

 Sin function
Back to top of page Version History and Bug List:
 Firmware Ver A1: Introduced.

Bugs: No known bugs.


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