PSF MLX90365 1.14
PSF MLX90365 1.14
M L X 9 0 3 65 P R O D U C T
S P E C I F IC F U N C T I O N S
S OFTWARE L IBRARY
1 Contents
1 CONTENTS .............................................................................................................................................................. 2
2 INTRODUCTION .................................................................................................................................................... 4
3 SOFTWARE STRUCTURE .................................................................................................................................... 4
3.1 Object Model ...................................................................................................................................................... 4
3.2 Object Structure and Hierarchy .......................................................................................................................... 5
3.3 Objects with Interfaces ....................................................................................................................................... 5
4 PSF090365AAMLXMANAGER OBJECT ............................................................................................................ 6
4.1 Background ......................................................................................................................................................... 6
5 PSF090365AAMLXDEVICE OBJECT .................................................................................................................. 7
5.1 Background ......................................................................................................................................................... 7
5.2 Scope of the PSF090365AAMLXDevice object ................................................................................................ 8
5.3 SelectedDevice Property ..................................................................................................................................... 8
5.4 PTC04 Property .................................................................................................................................................. 9
5.5 Solver Property ................................................................................................................................................. 10
5.6 Advanced Property ........................................................................................................................................... 10
5.7 ReadFullDevice Method ................................................................................................................................... 11
5.8 ProgramDevice Method .................................................................................................................................... 12
5.9 GetEEParameterCode Method .......................................................................................................................... 12
5.10 SetEEParameterCode Method .......................................................................................................................... 13
5.11 GetEEParameterValue Method ......................................................................................................................... 14
5.12 SetEEParameterValue Method ......................................................................................................................... 14
5.13 GetVdd Method ................................................................................................................................................ 15
5.14 GetIdd Method .................................................................................................................................................. 16
5.15 Measure Method ............................................................................................................................................... 16
5.16 GetAngle Method ............................................................................................................................................. 17
5.17 GetAngleOut Method ....................................................................................................................................... 18
5.18 DeviceReplaced Method ................................................................................................................................... 19
5.19 ReadEEParametersFromIni Method ................................................................................................................. 19
6 PSF090365AAMLXSOLVER OBJECT ............................................................................................................... 21
6.1 Background ....................................................................................................................................................... 21
6.2 Scope ................................................................................................................................................................ 21
6.3 Solver procedure flow – 5 Points ...................................................................................................................... 23
6.4 Solver procedure flow – 17 Points .................................................................................................................... 24
6.5 CopySolverSettingsToParameters Method ....................................................................................................... 24
6.6 CharacterizeOutputDAC Method ..................................................................................................................... 25
6.7 DefineDPByMidPos Method ............................................................................................................................ 26
6.8 DefineDPByAngle Method............................................................................................................................... 27
6.9 SetCoordinate0 Method .................................................................................................................................... 27
6.10 SetCoordinateA Method ................................................................................................................................... 28
6.11 SetCoordinateB Method ................................................................................................................................... 29
6.12 SetCoordinateC Method ................................................................................................................................... 29
6.13 SetCoordinateD Method ................................................................................................................................... 30
6.14 SetCoordinateE Method .................................................................................................................................... 31
6.15 SetSlopeS0 Method........................................................................................................................................... 32
6.16 SetSlopeA Method ............................................................................................................................................ 32
6.17 SetSlopeB Method ............................................................................................................................................ 32
6.18 SetSlopeC Method ............................................................................................................................................ 32
6.19 SetSlopeD Method ............................................................................................................................................ 32
6.20 SetFirstFitPoint Method .................................................................................................................................... 32
6.21 SetNextFitPoint Method ................................................................................................................................... 33
2 Introduction
PSF090365AAMLX is MS Windows software library, which meets the requirements for a Product Specific
Functions (PSF) module, defined in Melexis Programmable Toolbox (MPT) object model. The library
implements in-process COM objects for interaction with MLX90365 firmware for Melexis PTC04 programmers.
It is designed primarily to be used by MPT Framework application, but also can be loaded as a standalone in-
process COM server by other applications that need to communicate with the above-mentioned Melexis
products.
The library can be utilized in all programming languages, which support ActiveX automation. This gives great
flexibility in designing the application with the only limitation to be run on MS Windows OS. In many scripting
languages, objects can be directly created and used. In others, though, the first step during implementation is to
include the library in your project. The way it can be done depends on the programming language and the
specific Integrated Development Environment (IDE) used:
in C++ it can be imported by #import directive
in Visual Basic it either can be directly used as pure Object or added as a reference to the project
in C# it has to be added as a reference to the project
in NI LabView, for each Automation refnum the corresponding ActiveX class has to be selected
in NI LabWindows an ActiveX Controller has to be created
3 Software Structure
PSF090365AAMLXManager
PSF090365AAMLXDevice
Solver PSF090365AAMLXSolver
Advanced PSF090365AAMLXAdvanced
PTC04 PTC04PSFDevice
IPSF090365AAMLXDevice IMPTDevice
IPSFManager
IDispatch
IDispatch ISupportErrorInfo
PSF090365AAMLX PSF090365AAMLX
Manager Device ISpecifyPropertyPages
ISupportErrorInfo IPersist
IPSF090365AAMLXSolver IPSF090365AAMLXAdvanced
PSF090365AAMLX ISupportErrorInfo PSF090365AAMLX ISupportErrorInfo
Solver Advanced
IDispatch IDispatch
IPTC04PSFDevice IMPTDevice
IDispatch
ISupportErrorInfo
PTC04PSF
Device ISpecifyPropertyPages
IPersist
4 PSF090365AAMLXManager Object
4.1 Background
This object is created only once and is destroyed when the library is unmapped from process address space. Each
subsequent request for this object returns the same instance.
PSF090365AAMLXManager object implements standard MPT category
CATID_MLXMPTPSFSerialModule, which is required for automatic device scanning. C++ standalone client
applications can create an instance of this object by using the standard COM API CoCreateInstance with class ID
CLSID_PSF090365AAMLXManager, or ProgID “MPT. PSF090365AAMLXManager”:
hRes = ::CoCreateInstance(CLSID_PSF090365AAMLXManager, NULL, CLSCTX_INPROC,
IID_IPSFManager, (void**) &pPSFMan);
Visual Basic applications should call CreateObject function to instantiate PSF090365AAMLXManager:
Set PSFMan = CreateObject(“MPT. PSF090365AAMLXManager”)
The primary objective of this instantiation is to call ScanStandalone method. C++:
hRes = pPSFMan->ScanStandalone(dtSerial, varDevices, &pDevArray);
Or in Visual Basic:
Set DevArray = PSFMan.ScanStandalone(dtSerial)
ScanStandalone function returns collection of PSF090365AAMLXDevice objects, one for each connected PTC-
04 programmer. The collection is empty if there are no connected programmers.
5 PSF090365AAMLXDevice Object
5.1 Background
This object implements standard MPT category CATID_MLXMPTPSFSerialDevice as well as library specific
CATID_MLXMPT90365PTC04Device category. It also declares required specific category
CATID_MLXMPT90365PTC04UIModule for identification of required user interface modules.
This object can be created directly with CoCreateInstance/CreateObject or by calling the device scanning
procedure ScanStandalone of PSF090365AAMLXManager object. The following Visual Basic subroutine shows
how to instantiate PSF090365AAMLXDevice object by performing device scan on the system:
Sub CreateDevice()
Dim PSFMan As PSF090365AAMLXManager, DevicesCol As ObjectCollection, I As Long
On Error GoTo lError
lError:
MsgBox Err.Description
Err.Clear
End Sub
Developers can also manually connect the device object to a serial channel object thus bypassing standard device
scanning procedure. The following Visual Basic subroutine allows manual connection along with standard
device scanning depending on input parameter bAutomatic:
Sub CreateDevice(bAutomatic As Boolean)
Dim PSFMan As PSF090365AAMLXManager, DevicesCol As ObjectCollection, I As Long
Dim CommMan As CommManager, Chan As MPTChannel
On Error GoTo lError
If bAutomatic Then
' Automatic device scanning begins here
Set PSFMan = CreateObject("MPT.PSF090365AAMLXManager")
Set DevicesCol = PSFMan.ScanStandalone(dtSerial)
If DevicesCol.Count <= 0 Then
MsgBox ("No PTC-04 programmers found!")
Exit Sub
End If
lError:
MsgBox Err.Description
Err.Clear
End Sub
PSF090365AAMLXDevice object implements IMPTDevice standard MPT interface. Please refer to MPT
Developer reference document for description of the properties and methods of this interface.
In addition PSF090365AAMLXDevice object implements IPSF090365AAMLXDevice library specific
interface, which derives from IMPTDevice. The following is a description of its properties and methods.
5.3.1 Description
Specifies what die to be used by subsequent operations: It’s a soft switch, meaning that there is not an immediate
action visible on hardware.
All functions implemented in the library use the SelectedDevice property to determine what die (A or B) you‘re
working with. It also concerns settings as for example SetParameter.
5.3.2 Syntax
Visual Basic:
Property SelectedDevice as Long
C++:
HRESULT get_SelectedDevice(/*[out,retval]*/ int* pValue);
HRESULT set_SelectedDevice(/*[in]*/ int Value);
5.3.3 Parameters
Value
A int specifying new value for the property. 1 selects die A and 2 selects die B.
pValue
An address of int variable that receives current value of the property. 1 specifies that die A is currently
selected and 2 specifies that die B is currently selected.
Visual Basic:
1 if die A is currently selected or 2 if die B is currently selected.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pValue contains valid number.
Any other error code The operation failed.
5.4.1 Description
This property holds a reference to PTC04PSFDevice co-object.
5.4.2 Syntax
Visual Basic:
Property PTC04 as Object
C++:
HRESULT get_PTC04(/*[out][retval]*/ LPDISPATCH* pVal);
HRESULT set_PTC04(/*[in]*/ LPDISPATCH Value);
5.4.3 Parameters
Value
An IDispatch* specifying new PTC04 object. Nothing happens if the object is the same instance as the
existing one. Otherwise PSF090365AAMLXDevice object releases its current PTC04 object and connects
to the new one. This also includes replacing of the communication Channel object with the one from the
new PTC04 object.
pVal
Address of IDispatch* pointer variable that receives the interface pointer to the PTC04 device object. If
the invocation succeeds, the caller is responsible for calling IUnknown::Release() on the pointer when it
is no longer needed.
Visual Basic:
A reference to the PTC04 co-object.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pVal contains valid pointer.
Any other error code The operation failed. *pVal contains NULL.
5.5.1 Description
5.5.2 Syntax
Visual Basic:
Property Solver as Object
Read only
C++:
HRESULT get_Solver(/*[out][retval]*/ IPSF090365AAMLXSolver** pVal);
5.5.3 Parameters
pVal
Address of IPSF090365AAMLXSolver* pointer variable that receives the interface pointer to the Solver
object. If the invocation succeeds, the caller is responsible for calling IUnknown::Release() on the
pointer when it is no longer needed.
Visual Basic:
A reference to the Solver co-object.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pVal contains a valid pointer.
Any other error code The operation failed. *pVal contains NULL.
5.6.1 Description
5.6.2 Syntax
Visual Basic:
Property Advanced as Object
Read only
C++:
HRESULT get_Advanced(/*[out][retval]*/ IPSF090365AAMLXAdvanced* pVal);
5.6.3 Parameters
pVal
Address of IPSF090365AAMLXAdvanced* pointer variable that receives the interface pointer to the
Advanced object. If the invocation succeeds, the caller is responsible for calling IUnknown::Release()
on the pointer when it is no longer needed.
Visual Basic:
A reference to the Advanced co-object.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pVal contains a valid pointer.
Any other error code The operation failed. *pVal contains NULL.
5.7.1 Description
Reads the whole EEPROM of MLX90365. Updates the internal EEPROM cache with values taken from the
chip. This method is provided to speed up the performance because it updates the whole cache with a single
command.
Tip: Use the CheckCRC method to validate if the received EERPOM data is not corrupted.
5.7.2 Syntax
Visual Basic:
Sub ReadFullDevice()
C++:
HRESULT ReadFullDevice();
5.7.3 Parameters
None
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
5.8.1 Description
Writes the whole EEPROM of MLX90365. Takes the values from the internal EEPROM cache.
Only the variables that are modified will be programmed.
5.8.2 Syntax
Visual Basic:
Sub ProgramDevice()
C++:
HRESULT ProgramDevice();
5.8.3 Parameters
None
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
5.9.1 Description
Returns the code of a particular EEPROM parameter as it is represented in EEPROM. It is optimized because it
uses the EEPROM cache maintained by the library. ReadFullDevice method could be called before calling
GetEEParameterCode to update the whole cache. However GetEEParameterCode works correctly even if
ReadFullDevice is not called.
5.9.2 Syntax
Visual Basic:
Function GetEEParameterCode(paramID as ParamCodesEEPROM)
C++:
HRESULT GetEEParameterCode(/*[in]*/ ParamCodesEEPROM paramID, /*[out,retval]*/
TVariant* pVal);
5.9.3 Parameters
paramID
pVal
An address of VARIANT variable that will receive the return value of the method. The caller is
responsible to call VariantClear on that variable when it is no longer needed. The values are represented
as bytes or unsigned integers depending on the parameter.
Visual Basic:
A Variant containing the code of an EEPROM parameter.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pVal contains a valid value.
Any other error code The operation failed. *pVal is Empty.
5.10.1 Description
Changes the code of a particular EEPROM parameter. The method works with the EEPROM cache maintained
by the library.
ProgramDevice method must be called in order to update the EEPROM of the chip with the codes from the
cache.
5.10.2 Syntax
Visual Basic:
Sub SetEEParameterCode(paramID as ParamCodesEEPROM, Value)
C++:
HRESULT SetEEParameterCode(/*[in]*/ ParamCodesEEPROM paramID, /*[in]*/
TVariantInParam Value);
5.10.3 Parameters
paramID
A ParamCodesEEPROM constant specifying the ID of the EEPROM parameter.
Value
A VARIANT containing new code for the parameter.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
5.11.1 Description
Returns the translated value of a particular EEPROM parameter. It first calls GetEEParameterCode method
and then translates the code of the parameter into a suitable value. For example, the parameter ALPHAX is
translated into a floating point number which represents degrees.
Translation is not defined for all parameters and this method returns an error if it receives paramID which is not
supported.
5.11.2 Syntax
Visual Basic:
Function GetEEParameterValue(paramID as ParamCodesEEPROM)
C++:
HRESULT GetEEParameterValue(/*[in]*/ ParamCodesEEPROM paramID, /*[out,retval]*/
TVariant* pVal);
5.11.3 Parameters
paramID
A ParamCodesEEPROM constant specifying the ID of the EEPROM parameter.
pVal
An address of VARIANT variable that will receive the return value of the method. The caller is
responsible to call VariantClear on that variable when it is no longer needed.
Visual Basic:
A Variant containing the translated value of an EEPROM parameter.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pVal contains a valid value.
Any other error code The operation failed. *pVal is Empty.
5.12.1 Description
Changes the value of a particular EEPROM parameter. It first translates the value to a corresponding code and
then calls SetEEParameterCode method to modify the parameter in the cache. For example, this method
expects the parameter ALPHAX to be a floating point number which will be translated into a 2-byte code which
can be stored into the EEPROM.
Translation is not defined for all parameters and this method returns an error if it receives paramID which is not
supported.
ProgramDevice method must be called in order to update the EEPROM of the chip with the codes from the
cache.
5.12.2 Syntax
Visual Basic:
Sub SetEEParameter(paramID as ParamCodesEEPROM, Value)
C++:
HRESULT SetEEParameter(/*[in]*/ ParamCodesEEPROM paramID, /*[in]*/
TVariantInParam Value);
5.12.3 Parameters
paramID
A ParamCodesEEPROM constant specifying the ID of the EEPROM parameter.
Value
A VARIANT containing new value for the parameter.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
5.13.1 Description
Measures the VDD value of the selected device. Returns the value in a calibrated Voltage signal.
5.13.2 Syntax
Visual Basic:
Function GetVdd() as Single
C++:
HRESULT GetVdd(/*[out,retval]*/ float* pVal);
5.13.3 Parameters
pVal
An address of float variable that will receive the return value of the method.
Visual Basic:
A Single containing the VDD value of the selected device.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pVal contains a valid value.
Any other error code The operation failed. *pVal is zero.
5.14.1 Description
Measures the IDD value of the selected device.
5.14.2 Syntax
Visual Basic:
Function GetIdd() as Single
C++:
HRESULT GetIdd(/*[out,retval]*/ float* pVal);
5.14.3 Parameters
pVal
An address of float variable that will receive the return value of the method.
Visual Basic:
A Single containing the IDD value of the selected device.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pVal contains a valid value.
Any other error code The operation failed. *pVal is zero.
5.15.1 Description
Measures the resp. signal on the selected device and returns the value in %VDD or Absolute value or PWM. It is
important the relays controlling PWM or Voltage measurements (bits 2 and 3 of DB-IO byte accordingly for
DieA and DieB; PWM is on when the bit=1) to be properly set in advance. This can be done by the following
code fragments:
Visual Basic:
btDBIO = PTC.GetDBIO
If bPWM Then
btDBIO = btDBIO Or 4 Or 8
Else
btDBIO = btDBIO And (Not (4 Or 8))
End If
Call PTC.SetDBIO(btDBIO)
C++:
pPTC->GetDBIO(&btDBIO);
if (bPWM)
btDBIO |= (1 << 2) | (1 << 3);
else
btDBIO &= ~((1 << 2) | (1 << 3));
pPTC->SetDBIO(btDBIO);
5.15.2 Syntax
Visual Basic:
Function Measure(paramOut as MeasureParameters, paramType as MeasureTypes) as Single
C++:
HRESULT Measure(/*[in]*/ MeasureParameters paramOut, /*[in]*/ MeasureTypes
paramType, /*[out,retval]*/ float* pVal);
5.15.3 Parameters
paramID
A MeasureParameters constant specifying the output to measure.
paramID
A MeasureTypes constant specifying the type of measurement.
pVal
An address of float variable that will receive the return value of the method.
Visual Basic:
A Single containing the result of measurement.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pVal contains a valid value.
Any other error code The operation failed. *pVal is zero.
5.16.1 Description
Looks into the RAM, gets THETAR2P and returns an angle based on this value with respect to EE_DP and
EE_CCW parameters.
5.16.2 Syntax
Visual Basic:
Function GetAngle() as Single
C++:
HRESULT GetAngle(/*[out,retval]*/ float* pfAngle);
5.16.3 Parameters
pfAngle
An address of float variable that will receive the return value of the method in Degrees.
Visual Basic:
A Single containing the angle in Degrees.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pfAngle contains a valid value.
Any other error code The operation failed. *pfAngle is zero.
5.17.1 Description
Looks into the RAM, gets digital output THETAOUT and returns a corresponding value in %VDD.
5.17.2 Syntax
Visual Basic:
Function GetAngleOut() as Single
C++:
HRESULT GetAngleOut(/*[out,retval]*/ float* pfValue);
5.17.3 Parameters
pfValue
An address of float variable that will receive the return value of the method in %VDD.
Visual Basic:
A Single containing the return value in %VDD.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pfValue contains a valid value.
Any other error code The operation failed. *pfValue is zero.
5.18.1 Description
Informs the object that the sensor is replaced and the EEPROM cache and some internal variables should be
invalidated. Only the selected device is taken into account.
5.18.2 Syntax
Visual Basic:
Sub DeviceReplaced()
C++:
HRESULT DeviceReplaced();
5.18.3 Parameters
None
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
5.19.1 Description
This method reads EEPROM parameter values from INI file and stores them in the internal PC cache. Two
sections from the INI file will be scanned “[EEPROM Parameter Values]“ and “[EEPROM Parameter Codes]”.
Entries in the former section must be “parameter_name=float_value” and must have translation value defined in
ParamCodesEEPROM table. Entries in the later section must be “parameter_name=decimal_value” or
“parameter_name=0xhexadecimal_value”. If a parameter exists in both sections, its value will be taken from
“[EEPROM Parameter Values]” section. Parameters, which names are not defined for the current ChipVersion
will be skipped.
Here is an example of such an INI file:
...
[EEPROM Parameter Values]
LNRAX = 12.5
GAINMIN = 0
GAINMAX = 0x1A
...
ProgramDevice method must be called in order to update the EEPROM of the chip with the codes from the
cache.
5.19.2 Syntax
Visual Basic:
Sub ReadEEParametersFromIni(IniFileName As String, [OnlyFullWords As Boolean = False])
C++:
HRESULT ReadEEParametersFromIni(/*[in]*/ BSTR IniFileName, /*[in,defaultvalue(0)]*/
VARIANT_BOOL OnlyFullWords);
5.19.3 Parameters
IniFileName
A String, specifying the full path to an INI file, containing the parameters to set.
OnlyFullWords
A Boolean specifying if only parameters, which occupy full 16 bit word from EEPROM must be read
(True case). This will avoid eventual reading of EEPROM, which would happen if this parameter is
False and in the INI file there are parameters, which occupy only few bits from an EEPROM word.
Hence, with the True case it’s possible to program EEPROM of an IC without reading it.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
6 PSF090365AAMLXSolver Object
6.1 Background
This object cannot be created directly; it is only accessible as “Solver” property of PSF090365AAMLXDevice
object.
PSF090365AAMLXSolver object implements IPSF090365AAMLXSolver library specific interface. The
following is a description of its methods.
6.2 Scope
This object provides services to easy tune your product in your application.
When these functions are not fully serving your needs, you can check with your application contact into Melexis
how to get support.
Note: By using the PSF090365AAMLXDevice object, you’re always able to do everything what you want.
It is possible to use the second solver method and use two, three, four or five calibration points for defining the transfer
curve of the IC.
The first calibration point is always point 0, which is only used to calculate the slope to the second
Use method SetCoordinate0, SetCoordinateA, SetCoordinateB, SetCoordinateC, SetCoordinateD and SetCoordinateE
to calibrate the device.
Vout
100%
Diagnostic Area
Clamp high D
(CH)
C SC
CY
B SB
BY
AY A SA
S0
Clamp low 0
(CL)
0% Ax Bx Diagnostic Area Cx
Angular position or
3 rd calibration point :
4 th calibration point :
5 th calibration point :
2 nd calibration point :
1 st calibration point :
Position C
Position D
Position B
Position A
Position 0
Connect PTC-04
SetCoordinateA
Extra point ?
No
Solversetting Yes
SetCoordinateC
Maunually Automatic
Extra point ?
NoNo
SetSolversetting Load profile
Yes
SetCoordinateD
Yes
SetCoordinateE
DefineDPByAngle
Extra
parameters ?
Analog mode ?
Yes
Yes Setparameter
No
Characterize Output DAC
No
Program device
SetCoordinate0
Check device
Connect PTC-04
Select Device
NOP or contact test
Device replaced
CHIPVERSION
Readback
Check CRC
Extra point ?
Solversetting
Yes
SetNextFitPoint
Maunually Automatic
No
FitPoints
DefineDPByAngle
Extra
parameters ?
Yes
Analog mode ?
Setparameter
Yes No
Program device
SetFirstFitPoint
Check
6.5.1 Description
Copies all Solver settings (without Solver targets) to corresponding parameters in the EEPROM cache. Thus, a
client application could use just a profile to read the settings, optionally modify some of them and then do
CopySolverSettingsToParameters to set them in the EEPROM cache. This method should be called before
CharacterizeOutputDAC and SetMinGain methods.
6.5.2 Syntax
Visual Basic:
Sub CopySolverSettingsToParameters()
C++:
HRESULT CopySolverSettingsToParameters();
6.5.3 Parameters
None
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
6.6.1 Description
With this method, you can measure and calculate coefficients (OutputDacGain;OutputDacOffset) for level
correction of OUT1 and OUT2. The following is a detailed description of the steps:
All subsequent calls to SetEEParameterValue method will calculate the level value to store in the EEPROM by
using the following formula:
All subsequent calls to GetEEParameterValue method will calculate the level value from that in the EEPROM
by using the following formula:
NOTE: Also for all solver functions, only the selected die is taken in account!
NOTE: Gain and Offset coefficients can be read or write directly with GetSolverSetting and SetSolverSetting
functions, using setting codes SolverSettingOutput1DACGain, SolverSettingOutput1DACOffset,
SolverSettingOutput2DACGain and SolverSettingOutput2DACOffset
NOTE: Gain and Offset coefficients can be set to 1.0 and 0.0 respectively with a call to DeviceReplaced
method
6.6.2 Syntax
Visual Basic:
Sub CharacterizeOutputDAC()
C++:
HRESULT CharacterizeOutputDAC();
6.6.3 Parameters
None
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
6.7.1 Description
Reads current THETAR2P from the RAM of the device, calculates DP so that current position to correspond to
180 deg and stores it into EE_DP parameter.
6.7.2 Syntax
Visual Basic:
Function DefineDPByMidPos() as Single
C++:
HRESULT DefineDPByMidPos (/*[out,retval]*/ float* pDP);
6.7.3 Parameters
pDP
An address of Single variable receiving the calculated DP.
Visual Basic:
A Single containing the calculated DP.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
6.8.1 Description
Reads current THETAR2P from the RAM of the device, calculates DP so that current position to correspond to
the given angle and stores it into EE_DP parameter.
6.8.2 Syntax
Visual Basic:
Function DefineDPByAngle(Angle as Single) as Single
C++:
HRESULT DefineDPByAngle (/*[in]*/ float Angle, /*[out,retval]*/ float* pDP);
6.8.3 Parameters
Angle
A Single specifying the angle in [deg] for the current position.
pDP
An address of Single variable receiving the calculated DP.
Visual Basic:
A Single containing the calculated DP.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
6.9.1 Description
When the mechanical position is set to position 0, this function will make the INITIALISATION for solving this
device.
Actions:
* This function will only measure and remember the current angle in order to use it later in SetCoordinateA
method.
NOTE: Also for all solver functions, only the selected device is taken into account!
6.9.2 Syntax
Visual Basic:
C++:
HRESULT SetCoordinate0(/*[in]*/ float Level);
6.9.3 Parameters
Level
A Single specifying Y coordinate for the current position in %VDD (from 0.0 to 100.0).
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
6.10.1 Description
This method is called when the mechanical position is set to position A. It will treat next action:
Actions:
* This function will measure the current angle and use it to find out if the slope is positive or negative.
* It will store the X and Y coordinates of point A to the device
* It will clear (means FFFF) the coordinates for point B, C, D
* It will calculate slope 0 (before A) and copy it for all the slopes.
NOTE: Also for all solver functions, only the selected device is taken into account!
6.10.2 Syntax
Visual Basic:
Sub SetCoordinateA(Level as Single)
C++:
HRESULT SetCoordinateA(/*[in]*/ float Level);
6.10.3 Parameters
Level
A Single specifying Y coordinate of point A in %VDD (from 0.0 to 100.0).
C++:
The return value obtained from the returned HRESULT is one of the following:
6.11.1 Description
This method is called when the mechanical position is set to position B. It will treat next action:
NOTE: Also for all solver functions, only the selected device is taken in account!
NOTE: If this step is not executed, no problem will appear. This can happen in the case of a two points solver.
6.11.2 Syntax
Visual Basic:
Sub SetCoordinateB(Level as Single)
C++:
HRESULT SetCoordinateB(/*[in]*/ float Level);
6.11.3 Parameters
Level
A Single specifying Y coordinate of point B in %VDD (from 0.0 to 100.0).
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
6.12.1 Description
This method is called when the mechanical position is set to position C. It will treat next action:
NOTE: Also for all solver functions, only the selected device is taken in account!
NOTE: If this step is not executed, no problem will appear. This can happen in the case of a two points solver.
6.12.2 Syntax
Visual Basic:
Sub SetCoordinateC(Level as Single)
C++:
HRESULT SetCoordinateC(/*[in]*/ float Level);
6.12.3 Parameters
Level
A Single specifying Y coordinate of point C in %VDD (from 0.0 to 100.0).
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
6.13.1 Description
This method is called when the mechanical position is set to position D. It will treat next action:
NOTE: Also for all solver functions, only the selected device is taken in account!
NOTE: If this step is not executed, no problem will appear. This can happen in the case of a two points solver.
NOTE: This point also can be a fictive point, overwriting the slope for C can be done with the function
SetSlopeC.
6.13.2 Syntax
Visual Basic:
Sub SetCoordinateD(Level as Single)
C++:
HRESULT SetCoordinateD(/*[in]*/ float Level);
6.13.3 Parameters
Level
A Single specifying Y coordinate of point D in %VDD (from 0.0 to 100.0).
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
6.14.1 Description
This method is called when the mechanical position is set to position E. It will treat next action:
NOTE: Also for all solver functions, only the selected device is taken in account!
NOTE: If this step is not executed, no problem will appear. This can happen in the case of a two points solver.
NOTE: This point also can be a fictive point, overwriting the slope for D can be done with the function
SetSlopeD.
6.14.2 Syntax
Visual Basic:
Sub SetCoordinateE(Level as Single)
C++:
HRESULT SetCoordinateE(/*[in]*/ float Level);
6.14.3 Parameters
Level
A Single specifying Y coordinate of point E in %VDD (from 0.0 to 100.0).
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
6.19.1 Description
When you need a specific or fixed slope for resp A, B, C, D or S0, you can overwrite an eventual calculated
slope with this function.
6.19.2 Syntax
Visual Basic:
Sub SetSlopeA(Slope as Single)
C++:
HRESULT SetSlopeA(/*[in]*/ float Slope);
6.19.3 Parameters
Slope
A Single specifying slope to overwrite default or calculated slope in [%VDD / DEG].
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
6.20.1 Description
This method is called for the first position in order to make the initialization for the solving this device. It will
measure the current angle and store its value along with the given required level.
This method does not directly update EE_Yxx parameters. FitPoints method must be used as soon as all the
required points are defined.
NOTE: Also for all solver functions, only the selected device is taken into account!
6.20.2 Syntax
Visual Basic:
Sub SetFirstFitPoint(Level as Single)
C++:
HRESULT SetFirstFitPoint(/*[in]*/ float Level);
6.20.3 Parameters
Level
A Single specifying Y coordinate for the current position in %VDD (from 0.0 to 100.0).
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
6.21.1 Description
This method is called for each position after the first one. It will measure the current angle and store its value
along with the given required level. When the method is called for the second point it may define DP according
to the rotation direction and the slope between the first two points.
This method does not directly update EE_Yxx parameters. FitPoints method must be used as soon as all the
required points are defined.
NOTE: Also for all solver functions, only the selected device is taken into account!
6.21.2 Syntax
Visual Basic:
Sub SetNextFitPoint(Level as Single)
C++:
HRESULT SetNextFitPoint(/*[in]*/ float Level);
6.21.3 Parameters
Level
A Single specifying Y coordinate of point A in %VDD (from 0.0 to 100.0).
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
6.22.1 Description
This method can be called to remove the last stored position.
NOTE: Also for all solver functions, only the selected device is taken into account!
6.22.2 Syntax
Visual Basic:
Sub DeleteLastFitPoint()
C++:
HRESULT DeleteLastFitPoint();
6.22.3 Parameters
None
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
6.23.1 Description
This method is called when all the required points are defined. It will calculate the EE_Y0 – EE_Y16 parameters
using the specified algorithm.
NOTE: Also for all solver functions, only the selected device is taken into account!
6.23.2 Syntax
Visual Basic:
Sub FitPoints(Algorithm as Long, pMaxError as Single) as Long
C++:
HRESULT FitPoints(/*[in]*/long Algorithm, /*[out]*/float* pMaxError,
/*[out,retval]*/long* pMaxErrorPoint);
6.23.3 Parameters
Algorithm
A Long specifying the required algorithm. Possible values are:
1 – Linear interpolation
2 – Front end fit. This algorithm is applicable for as minimum as 6 defined points. If less points are
defined, linear interpolation algorithm is automatically selected.
pMaxError
An address of a Single variable receiving the maximum deviation between the defined points and
resulting transfer characteristic.
pMaxErrorPoint
An address of a Long variable receiving the number of point (starting with 1), where is the maximum
deviation.
Visual Basic:
A Long containing the number of point (starting with 1), where is the maximum deviation.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
6.24.1 Description
With this method, you can fix the levels for Clamping High \ Low. Usually this is the last step of the solver
procedure.
NOTE: Also for all solver functions, only the selected device is taken in account!
6.24.2 Syntax
Visual Basic:
Sub SetClamping(LowLevel as Single, HighLevel as Single)
C++:
HRESULT SetClamping(/*[in]*/ float LowLevel, /*[in]*/ float HighLevel);
6.24.3 Parameters
LowLevel
A Single specifying low clamping level in %VDD (from 0.0 to 100.0).
HighLevel
A Single specifying high clamping level in %VDD (from 0.0 to 100.0).
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
6.25.1 Description
This method finally tunes the frequency of PWM signal. It should be called after main calibration is done and
device is programmed, thus ensuring the correct output mode is established. Frequency is tuned by a
measurement of the signal on the output, recalculating EE_PWMT parameter and storing it into the cache. After
successful execution of SetPWMT, changed parameters can be programmed into device by ProgramDevice
method.
6.25.2 Syntax
Visual Basic:
Sub SetPWMT(Freq as Single)
C++:
HRESULT SetPWMT(/*[in]*/float Freq);
6.25.3 Parameters
Freq
A Single specifying the required frequency of the output signal in Hz.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
6.26.1 Description
This method enables or disables POWERSAVING option in EEPROM.
6.26.2 Syntax
Visual Basic:
C++:
HRESULT SetPowerSaving (/*[in]*/VARIANT_BOOL Enable);
6.26.3 Parameters
Enable
A Boolean specifying whether POWERSAVING to be enabled (True) or disabled (False).
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
6.27.1 Description
This method sets MEMLOCK parameter to 3 and programs the connected device. In case of success, further
trials for updating EEPROM of this device will fail.
Note, that this method is applicable for MLX90365ABD and newer.
6.27.2 Syntax
Visual Basic:
Sub Memlock()
C++:
HRESULT Memlock();
6.27.3 Parameters
None
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
7 PSF090365AAMLXAdvanced Object
7.1 Background
This object cannot be created directly; it is only accessible as “Advanced” property of
PSF090365AAMLXDevice object.
PSF090365AAMLXAdvanced object implements IPSF090365AAMLXAdvanced library specific interface. The
following is a description of its methods.
7.3.1 Description
Changes the VDD of MLX90365. This applies only to the selected die.
NOTE: Most of the PTC04 firmware commands manipulate VDD, thus the voltage set by this method is valid
until the next command is sent to the programmer. SetSetting method must be used if persistent voltage is
needed.
7.3.2 Syntax
Visual Basic:
Sub SetVdd(fVdd as Single)
C++:
HRESULT SetVdd(/*[in]*/ float fVdd);
7.3.3 Parameters
fVdd
A Single specifying new VDD in voltages.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
7.4.1 Description
Changes the VBat voltage of MLX90365 (PPS3 of PTC04). This applies to both dies.
NOTE: Many of the PTC04 firmware commands manipulate VBat, thus the voltage set by this method must be
considered valid until the next command is sent to the programmer. SetSetting method must be used if persistent
voltage is needed.
7.4.2 Syntax
Visual Basic:
Sub SetVBat(fVBat as Single)
C++:
HRESULT SetVBat(/*[in]*/ float fVBat);
7.4.3 Parameters
fVBat
A Single specifying new VBat in voltages.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
7.5.1 Description
Immediately sends the SelectDevice command to PTC04 programmer.
7.5.2 Syntax
Visual Basic:
Sub SelectDevice(nDev as Long)
C++:
HRESULT SelectDevice(/*[in]*/ int nDev);
7.5.3 Parameters
nDev
A Long specifying die A (1) or B (2).
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
7.6.1 Description
Returns the value of a particular setting.
7.6.2 Syntax
Visual Basic:
Function GetSetting(settingID as SettingCodes)
C++:
HRESULT GetSetting(/*[in]*/ SettingCodes settingID, /*[out,retval]*/ TVariant* pVal);
7.6.3 Parameters
settingID
A SettingCodes constant specifying the ID of the setting.
pVal
An address of VARIANT variable that will receive the return value of the method. The caller is
responsible to call VariantClear on that variable when it is no longer needed.
Visual Basic:
A Variant containing the value of a setting.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pVal contains valid value.
Any other error code The operation failed. *pVal is Empty.
7.7.1 Description
Changes the value of a particular setting. Sets an associated internal variable. The setting is also sent
immediately to PTC04 programmer.
NOTE: If necessary, the changes can be saved in the profile with a subsequent call to SaveProfile or
SaveProfileAs methods.
7.7.2 Syntax
Visual Basic:
Sub SetSetting(settingID as SettingCodes, Value)
C++:
HRESULT SetSetting(/*[in]*/ SettingCodes settingID, /*[in]*/ TVariantInParam Value);
7.7.3 Parameters
settingID
A SettingCodes constant specifying the ID of the setting to modify.
Value
A VARIANT containing new value for the setting.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
7.8.1 Description
Specifies if the setting will be stored in the profile when SaveProfile or SaveProfileAs methods are called.
These usage flags are also updated by OpenProfile method – a certain setting is marked as “used” if it exists in
the profile being opened, otherwise it is marked as unused and a default value is assigned to the setting itself.
7.8.2 Syntax
Visual Basic:
Property SettingInUse(settingID as SettingCodes) as Boolean
C++:
HRESULT get_SettingInUse(/*[in]*/ SettingCodes settingID, /*[out,retval]*/
VARIANT_BOOL* pValue);
HRESULT set_SettingInUse(/*[in]*/ SettingCodes settingID, /*[in]*/ VARIANT_BOOL Value);
7.8.3 Parameters
settingID
A SettingCodes constant specifying the ID of the setting to get or modify its usage.
pValue
An address of VARIANT_BOOL variable that receives current value of the property.
VARIANT_TRUE means that the associated setting is used, VARIANT_FALSE means unused.
Value
A VARIANT_BOOL specifying new value for the property. VARIANT_TRUE marks the associated
setting as used, VARIANT_FALSE – as unused.
Visual Basic:
True if the associated setting is in use, False otherwise.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pValue contains valid value.
Any other error code The operation failed.
7.9.1 Description
Returns the value of a particular solver setting.
NOTE: The module is just a container for the solver settings and completely ignores them. This method provides
an interface for higher layers to access the contents of the profile. The higher layers are responsible to read these
settings when necessary and put them at the right places (usually the EEPROM of the selected die) as part of
their solver sequence.
NOTE: The solver targets, kept in the profile, are also accessible with this method.
7.9.2 Syntax
Visual Basic:
Function GetSolverSetting(settingID as SolverSettingCodes)
C++:
HRESULT GetSolverSetting(/*[in]*/ SolverSettingCodes settingID, /*[out,retval]*/ TVariant*
pVal);
7.9.3 Parameters
settingID
A SolverSettingCodes constant specifying the ID of the solver setting.
pVal
An address of VARIANT variable that will receive the return value of the method. The caller is
responsible to call VariantClear on that variable when it is no longer needed.
Visual Basic:
A Variant containing the value of a solver setting.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pVal contains valid value.
Any other error code The operation failed. *pVal is Empty.
7.10.1 Description
Changes the value of a particular solver setting.
NOTE: If necessary, the changes can be saved in the profile with a subsequent call to SaveProfile or
SaveProfileAs methods.
NOTE: The module is just a container for the solver settings and completely ignores them. This method provides
an interface for higher layers to change the contents of the profile. The higher layers are responsible to read these
settings when necessary and put them at the right places (usually the EEPROM of the selected die) as part of
their solver sequence.
NOTE: The solver targets, kept in the profile, are also accessible with this method.
7.10.2 Syntax
Visual Basic:
Sub SetSolverSetting(settingID as SolverSettingCodes, Value)
C++:
HRESULT SetSolverSetting(/*[in]*/ SolverSettingCodes settingID, /*[in]*/ TVariantInParam
Value);
7.10.3 Parameters
settingID
A SolverSettingCodes constant specifying the ID of the solver setting to modify.
Value
A VARIANT containing new value for the solver setting.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
7.11.1 Description
Specifies if the solver setting will be stored in the profile when SaveProfile or SaveProfileAs methods are
called. These usage flags are also updated by OpenProfile method – a certain solver setting is marked as “used”
if it exists in the profile being opened, otherwise it is marked as unused and a default value is assigned to the
setting itself.
NOTE: The usage of the solver targets, kept in the profile, is also accessible with this method.
7.11.2 Syntax
Visual Basic:
Property SolverSettingInUse(settingID as SolverSettingCodes) as Boolean
C++:
HRESULT get_SolverSettingInUse(/*[in]*/ SolverSettingCodes settingID, /*[out,retval]*/
VARIANT_BOOL* pValue);
HRESULT set_SolverSettingInUse(/*[in]*/ SolverSettingCodes settingID, /*[in]*/
VARIANT_BOOL Value);
7.11.3 Parameters
settingID
A SolverSettingCodes constant specifying the ID of the solver setting to get or modify its usage.
pValue
An address of VARIANT_BOOL variable that receives current value of the property.
VARIANT_TRUE means that the associated solver setting is used, VARIANT_FALSE means unused.
Value
A VARIANT_BOOL specifying new value for the property. VARIANT_TRUE marks the associated
solver setting as used, VARIANT_FALSE – as unused.
Visual Basic:
True if the associated solver setting is in use, False otherwise.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pValue contains valid value.
Any other error code The operation failed.
7.12.1 Description
Opens the specified file and updates the settings.
7.12.2 Syntax
Visual Basic:
Sub OpenProfile(FileName as String)
C++:
HRESULT OpenProfile(/*[in]*/ BSTR FileName);
7.12.3 Parameters
FileName
A String specifying the path of the file to open.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
7.13.1 Description
Saves the settings into a previously opened profile. This function fails if there is not a profile in use.
7.13.2 Syntax
Visual Basic:
Sub SaveProfile()
C++:
HRESULT SaveProfile();
7.13.3 Parameters
None
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
7.14.1 Description
Saves the settings into the specified file.
7.14.2 Syntax
Visual Basic:
Sub SaveProfileAs(FileName as String)
C++:
HRESULT SaveProfileAs(/*[in]*/ BSTR FileName);
7.14.3 Parameters
FileName
A String specifying the path of the file.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
7.15.1 Description
Reads the whole RAM of MLX90365. Updates the internal RAM cache with values taken from the chip. This
method is provided to speed up the performance because it updates the whole cache with a single command.
7.15.2 Syntax
Visual Basic:
Sub ReadFullRAM()
C++:
HRESULT ReadFullRAM();
7.15.3 Parameters
None
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
7.16.1 Description
Writes the whole RAM of MLX90365. Takes the values from the internal RAM cache.
Only the variables that are modified will be programmed.
7.16.2 Syntax
Visual Basic:
Sub ProgramRAM()
C++:
HRESULT ProgramRAM();
7.16.3 Parameters
None
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
7.17.1 Description
Returns the code of a particular RAM parameter. It is optimized because it uses the RAM cache maintained by
the library. ReadFullRAM method could be called before calling GetRAMParameter to update the whole
cache. However GetRAMParameter works correctly even if ReadFullRAM is not called.
7.17.2 Syntax
Visual Basic:
Function GetRAMParameter(paramID as ParamCodesRAM)
C++:
HRESULT GetRAMParameter(/*[in]*/ ParamCodesRAM paramID, /*[out,retval]*/ TVariant*
pVal);
7.17.3 Parameters
paramID
A ParamCodesRAM constant specifying the ID of the RAM parameter.
pVal
An address of VARIANT variable that will receive the return value of the method. The caller is
responsible to call VariantClear on that variable when it is no longer needed.
Visual Basic:
A Variant containing the value of a RAM parameter.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pVal contains a valid value.
Any other error code The operation failed. *pVal is Empty.
7.18.1 Description
Changes the code of a particular RAM parameter. The method works with the RAM cache maintained by the
library.
ProgramRAM method must be called in order to update the RAM of the chip with the codes from the cache.
7.18.2 Syntax
Visual Basic:
Sub SetRAMParameter(paramID as ParamCodesRAM, Value)
C++:
HRESULT SetRAMParameter(/*[in]*/ ParamCodesRAM paramID, /*[in]*/ TVariantInParam
Value);
7.18.3 Parameters
paramID
A ParamCodesRAM constant specifying the ID of the RAM parameter to modify.
Value
A VARIANT containing new value for the RAM parameter.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
7.19.1 Description
Returns the code of a particular RAM parameter. In contrast to GetRAMParameter, this method directly reads
data from the device’s RAM.
7.19.2 Syntax
Visual Basic:
Function GetRAMParameterDirect(paramID as ParamCodesRAM)
C++:
HRESULT GetRAMParameterDirect(/*[in]*/ ParamCodesRAM paramID, /*[out,retval]*/
TVariant* pVal);
7.19.3 Parameters
paramID
A ParamCodesRAM constant specifying the ID of the RAM parameter.
pVal
An address of VARIANT variable that will receive the return value of the method. The caller is
responsible to call VariantClear on that variable when it is no longer needed.
Visual Basic:
A Variant containing the value of a RAM parameter.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pVal contains a valid value.
Any other error code The operation failed. *pVal is Empty.
7.20.1 Description
Changes the code of a particular RAM parameter. In contrast to SetRAMParameter, this method directly writes
data to the device’s RAM.
7.20.2 Syntax
Visual Basic:
Sub SetRAMParameterDirect(paramID as ParamCodesRAM, Value)
C++:
HRESULT SetRAMParameterDirect(/*[in]*/ ParamCodesRAM paramID, /*[in]*/
TVariantInParam Value);
7.20.3 Parameters
paramID
A ParamCodesRAM constant specifying the ID of the RAM parameter to modify.
Value
A VARIANT containing new value for the RAM parameter.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
7.21.1 Description
Sends MemWriteWithCRC command to PTC04 programmer. Writes 2 bytes into chip’s memory.
7.21.2 Syntax
Visual Basic:
Sub MemWriteWithCRC(Addr as Long, Data as Long, Ack as Long, Tim as Long, T1 as Long,
T2 as Long, T3 as Long, T4 as Long)
C++:
HRESULT MemWriteWithCRC(/*[in]*/ long Addr, /*[in]*/ long Data, /*[out]*/ int* Ack,
/*[out]*/ int* Tim, /*[out]*/ int* T1, /*[out]*/ int* T2, /*[out]*/ int* T3, /*[out]*/
int* T4);
7.21.3 Parameters
Addr
A Long specifying memory address to modify in the chip. Only the lowest 16 bits are used.
Data
A Long containing new value to write in the chip. Only the lowest 16 bits are used.
Ack
An address of int variable that will receive the acknowledge data returned from the chip during the
communication. This pointer could be NULL if this value is not needed.
Tim
An address of int variable that will receive the Tim timing measured during the communication with the
chip. This pointer could be NULL if this value is not needed.
T1
An address of int variable that will receive the T1 timing measured during the communication with the
chip. This pointer could be NULL if this value is not needed.
T2
An address of int variable that will receive the T2 timing measured during the communication with the
chip. This pointer could be NULL if this value is not needed.
T3
An address of int variable that will receive the T3 timing measured during the communication with the
chip. This pointer could be NULL if this value is not needed.
T4
An address of int variable that will receive the T4 timing measured during the communication with the
chip. This pointer could be NULL if this value is not needed.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
7.22.1 Description
Sends MemWrite command to PTC04 programmer. Writes 2 bytes into chip’s memory.
7.22.2 Syntax
Visual Basic:
Sub MemWrite(Addr as Long, Data as Long, Ack as Long, Tim as Long, T1 as Long, T2 as
Long)
C++:
HRESULT MemWrite(/*[in]*/ long Addr, /*[in]*/ long Data, /*[out]*/ int* Ack, /*[out]*/ int*
Tim, /*[out]*/ int* T1, /*[out]*/ int* T2);
7.22.3 Parameters
Addr
A Long specifying memory address to modify in the chip. Only the lowest 16 bits are used.
Data
A Long containing new value to write in the chip. Only the lowest 16 bits are used.
Ack
An address of int variable that will receive the acknowledge data returned from the chip during the
communication. This pointer could be NULL if this value is not needed.
Tim
An address of int variable that will receive the Tim timing measured during the communication with the
chip. This pointer could be NULL if this value is not needed.
T1
An address of int variable that will receive the T1 timing measured during the communication with the
chip. This pointer could be NULL if this value is not needed.
T2
An address of int variable that will receive the T2 timing measured during the communication with the
chip. This pointer could be NULL if this value is not needed.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
7.23.1 Description
Sends MemRead command to PTC04 programmer. Reads 2 bytes from chip’s memory.
7.23.2 Syntax
Visual Basic:
Function MemRead(Addr as Long, CRCrec as Long) as Long
C++:
HRESULT MemRead(/*[in]*/ long Addr, /*[out]*/ int* CRCrec, /*[out,retval]*/ long* pData);
7.23.3 Parameters
Addr
A Long specifying memory address to read from the chip. Only the lowest 16 bits are used.
CRCrec
An address of int variable that will receive the CRC data returned from the chip during the
communication. This pointer could be NULL if this value is not needed.
pData
An address of long variable that will receive the return value of the method. Only the lowest 16 bits are
valid, the highest 16 bits are always zero.
Visual Basic:
A Long containing the value that is read from the chip’s memory.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pData contains valid value.
Any other error code The operation failed. *pData is zero.
7.24.1 Description
The same as MemRead method, but also checks if received CRC is correct. In case of mismatch it returns an
error.
7.24.2 Syntax
Visual Basic:
Function MemReadSafe(Addr as Long) as Long
C++:
HRESULT MemReadSafe(/*[in]*/ long Addr, /*[out,retval]*/ long* pData);
7.24.3 Parameters
Addr
A Long specifying memory address to read from the chip. Only the lowest 16 bits are used.
pData
An address of long variable that will receive the return value of the method. Only the lowest 16 bits are
valid, the highest 16 bits are always zero.
Visual Basic:
A Long containing the value that is read from the chip’s memory.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pData contains valid value.
Any other error code The operation failed. *pData is zero.
7.25.1 Description
Sends ReadData command to PTC04 programmer. Reads a certain number of words from the chip’s memory.
7.25.2 Syntax
Visual Basic:
Function ReadData(Addr as Long, N as Long, Format as Long)
C++:
HRESULT ReadData(/*[in]*/ long Addr, /*[in]*/ long N, /*[in]*/ long Format, /*[out,retval]*/
TVariant* varData);
7.25.3 Parameters
Addr
A Long specifying memory address to start reading from the chip. Only the lowest 16 bits are used.
N
A Long specifying a number of words to be read (up to 125).
Format
A Long specifying the format of the returned data in varData. Possible values are:
Value Format
1 Return value is an array of bytes
2 Return value is an ANSI string packed in bstrVal member of *varData. This is the
preferred format for C++ applications because of the best performance. It is a binary
data so the string can contain zeroes and may not be zero terminated. Callers can get its
real length by calling SysStringByteLen API on bstrVal member
4 Return value is an array of words (Integers). This is the preferred format for Visual
Basic applications
varData
An address of VARIANT variable that will receive the return value of the method. The caller is
responsible to call VariantClear on that variable when it is no longer needed.
Visual Basic:
A Variant containing the data read from the chip.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *varData contains valid value.
Any other error code The operation failed. *varData is Empty.
7.26.1 Description
Sends WriteData command to PTC04 programmer. Writes a certain number of words into the chip’s memory.
7.26.2 Syntax
Visual Basic:
Sub WriteData(Format as Long, arr)
C++:
HRESULT WriteData(/*[in]*/ long Format, /*[in]*/ TVariantInParam arr);
7.26.3 Parameters
Format
A Long specifying the format of the data in arr. Possible values are:
Value Format
1 arr is an array of words (Integers) in the following format:
where Add0 is the first memory address to change and Word0 is the new value for that
memory cell, Add1 is the second memory address and Word1 is the corresponding new
value and so on.
2 arr is an ANSI string packed in bstrVal member. This is the preferred format for C++
applications because of the best performance. It is a binary data so the string can contain
zeroes and may not be zero terminated.
arr
A VARIANT containing the data to be written.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
7.27.1 Description
Sends SetDBMux command to PTC04 programmer.
7.27.2 Syntax
Visual Basic:
Sub SetDBMux(MUXChanNr as Byte)
C++:
HRESULT SetDBMux(/*[in]*/ unsigned char MUXChanNr);
7.27.3 Parameters
MUXChanNr
A Byte specifying new channel for the mux.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
7.28.1 Description
Sends HotReset command to PTC04 programmer.
7.28.2 Syntax
Visual Basic:
Function HotReset() As Long
C++:
HRESULT HotReset(/*[out,retval]*/ int* Ack);
7.28.3 Parameters
Ack
An address of int variable that will receive the acknowledge data returned from the chip during the
communication.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *Ack contains valid value.
Any other error code The operation failed. *Ack is zero.
7.29.1 Description
Sends NopAlive command to PTC04 programmer.
7.29.2 Syntax
Visual Basic:
Function NopAlive() As Long
C++:
HRESULT NopAlive(/*[out,retval]*/ int* Ack);
7.29.3 Parameters
Ack
An address of int variable that will receive the acknowledge data returned from the chip during the
communication.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *Ack contains valid value.
Any other error code The operation failed. *Ack is zero.
7.30.1 Description
Sends DisconnectUart command to PTC04 programmer. It disconnects the output of the chip from the Uart line
on the daughter board. Such disconnected output can be measured with external equipment.
There is no ConnectUart command. The firmware connects the output automatically when necessary.
7.30.2 Syntax
Visual Basic:
Sub DisconnectDevice()
C++:
HRESULT DisconnectDevice();
7.30.3 Parameters
None
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
7.31.1 Description
Checks validity of the EEPROM. It calculates CRC of the EEPROM cells and compares it with corresponding
data in EEPROM.
7.31.2 Syntax
Visual Basic:
C++:
HRESULT CheckCRC(/*[out]*/ long* pCRC, /*[out,retval]*/ VARIANT_BOOL pbValue);
7.31.3 Parameters
pCRC
An address of long variable that will receive the CRC calculated by the method.
pbValue
An address of Boolean variable that will receive the return value of the method. True means that CRC is
OK, False – CRC is different.
Visual Basic:
A Boolean containing the return value of the method. True means that CRC is OK, False – CRC is
different.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pCRC and *pbValue contain
valid values.
Any other error code The operation failed. *pCRC and *pbValue are zero.
7.32.1 Description
Specifies whether the objects (PSF090365AAMLXDevice, PSF090365AAMLXSolver and
PSF090365AAMLXAdvanced) perform logging of their activity.
7.32.2 Syntax
Visual Basic:
Property Logging as Boolean
C++:
HRESULT get_Logging(/*[out,retval]*/ VARIANT_BOOL* pValue);
HRESULT set_Logging(/*[in]*/ VARIANT_BOOL Value);
7.32.3 Parameters
pValue
An address of VARIANT_BOOL variable that receives current value of the property.
VARIANT_TRUE means that logging is active, VARIANT_FALSE means inactive.
Value
A VARIANT_BOOL specifying new value for the property. VARIANT_TRUE activates the logging,
VARIANT_FALSE deactivates it.
Visual Basic:
True if logging is active, False otherwise.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pValue contains valid value.
Any other error code The operation failed.
7.33.1 Description
Specifies the version of the connected MLX90365 chip. This value determines the EEPROM map in use and
some settings, specific for each different version of the chip. Normally this property is set once as part of the
initialization of the software.
7.33.2 Syntax
Visual Basic:
Property ChipVersion as Long
C++:
HRESULT get_ChipVersion(/*[out,retval]*/ long* pValue);
HRESULT set_ChipVersion(/*[in]*/ long Value);
7.33.3 Parameters
pValue
An address of Long variable that receives current value of the property.
Value
A Long specifying new value for the property. The possible values are:
1 Chip is MLX90365AAA
2 (default) Chip is MLX90365ABB
4 Chip is MLX90365ABD
Visual Basic:
A Long, containing current value of the property.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully. *pValue contains valid value.
Any other error code The operation failed.
7.34.1 Description
This method recognizes the version of the connected chip.
7.34.2 Syntax
Visual Basic:
Function ReadChipVersion as Long
C++:
HRESULT ReadChipVersion(/*[out,retval]*/long* pValue);
7.34.3 Parameters
pValue
An address of Long variable that will receive a code corresponding to the specific chip version. Here is
the list of the possible codes:
0 Chip is not recognized or not connected properly
1 Chip is MLX90365AAA
2 Chip is MLX90365ABB
4 Chip is MLX90365ABD
Visual Basic:
A Long containing a code corresponding to the specific chip version. See description of pValue above
for the list of the possible codes.
C++:
The return value obtained from the returned HRESULT is one of the following:
Return value Meaning
S_OK The operation completed successfully.
Any other error code The operation failed.
8 Enumeration constants
90365ABD
90365AAA
90365ABB
R/W
Value
Translation
Bits
Constant Description Cluster location
value
90365ABD
90365AAA
90365ABB
R/W
Value
Translation
Bits
Constant Description Cluster location
value
90365ABD
90365AAA
90365ABB
R/W
Value
Translation
Bits
Constant Description Cluster location
value
90365ABD
90365AAA
90365ABB
R/W
Value
Translation
Bits
Constant Description Cluster location
value
90365ABD
90365AAA
90365ABB
R/W
Value
Translation
Bits
Constant Description Cluster location
value
90365ABD
90365AAA
90365ABB
R/W
Value
Translation
Bits
Constant Description Cluster location
value
90365ABD
90365AAA
90365ABB
Value
Bytes
Constant Description
Value
Constant Description
Constant Description
Default
Constant Type Description
value
In use by
default
Value
Default
Constant Type Description
value
Default
Constant Type Description
value
In use by
default
Value
Default
Constant Type Description
value
[%VDD/deg]
0.0
SolverTargetSlopeSD 19 float (Single) No Slope after point D
[%VDD/deg]
SolverSettingDP 20 float (Single) 0.0 [deg] Yes DP
SolverSetting4Points 21 Byte 0 Yes 0=17point;1=4points
0 - Atan ( Y / X)
SolverSettingMapXYZ 22 Byte 0 Yes 1 - Atan ( k X / Z )
2 - Atan ( Z / kY)
False (counter-
SolverSettingRotationDirection 23 Boolean Yes Rotation direction
clockwise)
Working range for 17
point mode:
0 - 360°
1 - 320°
2 - 288°
3 - 261.8°
4 - 240°
5 - 221.5°
6 - 205.7°
SolverSettingWorkRange 24 Byte 0 (360°) Yes
7 - 192°
8 - 180°
9 - 144°
10 - 120°
11 - 102.9°
12 - 90°
13 - 80°
14 - 72°
15 - 65.5°
* These settings are never saved to or read from the profile, thus they are constantly marked as unused
9 History records
Version Date Comments
1.14 Sep 10, 2013 Added method Solver.SetPowerSaving
1.13_1 July 24, 2013 Chipversion Corrected
1.13 July 22, 2013 EEPROM /RAM description updated , Hotreset obseleted
1.12 Jun 24, 2013 Added support for MLX90365ABD; Added Solver.Memlock method
1.07 Jun 26, 2012 Added SettingBaudrateSyncDiff and Advanced.MemReadSafe
1.05.02 Feb 28 , 2012 EEPROM description CW corrected, MAPXYZ solversetting corrected
1.05.01 Jan 11 , 2012 EEPROM description added
( was 1.06)
1.05 Dec 23, 2011 Added support of MLX90365ABB
1.03 Sep 17, 2011 Added ReadEEParametersFromIni method
1.01 Jun 2, 2011 Initial release
10 Disclaimer
Devices sold by Melexis are covered by the warranty and patent indemnification provisions appearing in its
Term of Sale. Melexis makes no warranty, express, statutory, implied, or by description regarding the
information set forth herein or regarding the freedom of the described devices from patent infringement.
Melexis reserves the right to change specifications and prices at any time and without notice. Therefore,
prior to designing this product into a system, it is necessary to check with Melexis for current information.
This product is intended for use in normal commercial applications. Applications requiring extended
temperature range, unusual environmental requirements, or high reliability applications, such as military,
medical life-support or life-sustaining equipment are specifically not recommended without additional
processing by Melexis for each application.
The information furnished by Melexis is believed to be correct and accurate. However, Melexis shall not be
liable to recipient or any third party for any damages, including but not limited to personal injury, property
damage, loss of profits, loss of use, interrupt of business or indirect, special incidental or consequential
damages, of any kind, in connection with or arising out of the furnishing, performance or use of the technical
data herein. No obligation or liability to recipient or any third party shall arise or flow out of Melexis’ rendering
of technical or other services.
© 2004 Melexis NV. All rights reserved.
website at:
www.melexis.com
Or for additional information contact Melexis Direct: