Hi,
After successfully running sample code for MSPGANG programmer, CPP_Interactive_MSP_DLL, I tried to convert the sample code in VB6, however, I found same DLL working in the sample code but could not work properly in VB6.
Issue 1:
Declare Function MSPGANG_GetErrorString Lib "C:\MSPGANG\MSP-Gang.dll" (ByVal errCode As Long) As String
The function could not return any error description.
Issue 2:
Declare Function MSPGANG_Interactive_Open_Target_Device Lib "C:\MSPGANG\MSP-Gang.dll" (ByVal Name As String) As Long
After call the function : lPRGSValue = MSPGANG_Interactive_Open_Target_Device("Demo"), I got error number 23, on MSPGANG programmer user guide page 41, it says:
ERROR # 023 - MCU device init.
So I tracked back the function used to initialise the MCU:
Declare Function MSPGANG_Set_MCU_Name Lib "C:\MSPGANG\MSP-Gang.dll" (ByVal S As String) As Long
lPRGSValue = MSPGANG_Set_MCU_Name(strDeviceType)
Where strDeviceType is declared as string with 23 character length : Dim strDeviceType As String * 23
The data format passed for strDeviceType is exactly the same as data passed in the sample code:
Data passed in VB:
Bit Char Asc(Char)
0 M 77
1 S 83
2 P 80
3 4 52
4 3 51
5 0 48
6 F 70
7 5 53
8 3 51
9 2 50
10 5 53
11 32
12 32
13 32
14 32
15 32
16 32
17 32
18 32
19 32
20 0
21 0
22 0
Declaration in sample code:
LONG WINAPI MSPGANG_Interactive_Open_Target_Device( LPTSTR name );
Data passed in sample code:
0x005aa094 "MSP430F5325 "
[0]: 77 'M'
[1]: 83 'S'
[2]: 80 'P'
[3]: 52 '4'
[4]: 51 '3'
[5]: 48 '0'
[6]: 70 'F'
[7]: 53 '5'
[8]: 51 '3'
[9]: 50 '2'
[10]: 53 '5'
[11]: 32 ' '
[12]: 32 ' '
[13]: 32 ' '
[14]: 32 ' '
[15]: 32 ' '
[16]: 32 ' '
[17]: 32 ' '
[18]: 32 ' '
[19]: 32 ' '
[20]: 0
[21]: 0
[22]: 0
It seems to me that, I could have issue to convert the C++ to VB6 when LPTSTR is passed or returned. Did I miss anything? Can anybody help to solve these issues as we have very limit timeframe on this? Thank you.
Regards,
Lisa