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.
| | Object | Size | Description | A1 | A2 | B1 | B2 | C1 |
 | oConverter | 3 Bytes | Provides conversion functions. | x | x | x | x | x |
 | oConverterC | 5 Bytes | Provides conversion functions. | x | x | x |
|
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. |
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 |
 | oConverter |  | oConverterC |
|
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 |
|
| Operate | Constant | Description |
| 0 | cvOff | The Output Objects Value is not updated. |
| 1 | cvOn | 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 |
|
| InvertOut | Description |
| 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 |
|
| Mode | Constant | Description |
| 0 | cv7Seg | Binary to/from 7 Segment display. |
| 1 | cvPhase | Binary to 8-Phase Stepper-Motor. |
| 2 | cvSin | Binary to/from Sine. This can also be done in program code with the sin Function. |
| 3 | cvDecimal | 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 |
|
| Blank | Description |
| 0 | The Output Object is updated with the converted information. |
| 1 | The Output Object's bits are all set to 0. |
|
|
Process Clock |
|
| 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 |
|
|
|
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 | |
|
Related Items:
|
| | Sin function |
Version History and Bug List: |
| | Firmware Ver A1: Introduced. Bugs: No known bugs. |