I need a translation of a Visual Basic program to [login to view URL] program sets the device attached to the serial port to a specific mode for recording noise (in dB(A)) and was designed for VB on Windows. I need this for an open source project on Rasberry PI.
The original program is attached. I just need the converted functions to set the mode to 1 (1 Microphone, 1000ms) or 2 (2 Microphones input, 1000ms). There is no need for GUI or other functions.
Direct access via GRE or L2TP to Rasberry is possible, also L2TP for Windows with attached hardware Device is possible. So remote work can be done.
There is some more programming where I could need help, so this is just the first snipplet.
The original Program is:
VERSION 5.00
Begin [login to view URL] Form1
Appearance = 0 '2D
BackColor = &H80000016&
Caption = "DBA-Logger Modus"
ClientHeight = 4770
ClientLeft = 1590
ClientTop = 1500
ClientWidth = 6015
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
LinkTopic = "Form1"
PaletteMode = 1 'ZReihenfolge
Picture = "[login to view URL]":0000
ScaleHeight = 4770
ScaleWidth = 6015
Begin [login to view URL] Command3
Caption = "Testen"
Height = 735
Left = 360
TabIndex = 7
Top = 3480
Width = 1815
End
Begin [login to view URL] Combo1
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 2520
TabIndex = 5
Text = "Combo1"
Top = 2400
Width = 3015
End
Begin [login to view URL] Command2
Caption = "Modus ändern"
Height = 735
Left = 360
TabIndex = 4
Top = 2280
Width = 1815
End
Begin [login to view URL] Text3
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2520
TabIndex = 3
Top = 1320
Width = 735
End
Begin [login to view URL] Command1
Caption = "Modus lesen"
Height = 735
Left = 360
TabIndex = 2
Top = 1200
Width = 1815
End
Begin [login to view URL] Text1
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 2640
TabIndex = 1
Text = "1"
Top = 240
Width = 255
End
Begin [login to view URL] Text2
Appearance = 0 '2D
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2520
TabIndex = 0
Text = "0"
Top = 3600
Width = 2175
End
Begin [login to view URL] Label1
Caption = "Bitte COM wählen"
Height = 255
Left = 480
TabIndex = 6
Top = 360
Width = 1575
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim n
Dim Integral
Dim Modus
Private Sub Command1_Click()
OpenString = "COM" + [login to view URL] + ":9600,N,8,1"
i = OPENCOM(OpenString)
If i = 0 Then
MsgBox ("Schnittstelle nicht verfügbar")
Else
DTR 1
RTS 1
TIMEINIT
SENDBYTE 27
CLEARBUFFER
d = READBYTE()
If d = 27 Then
SENDBYTE 11
d = READBYTE
[login to view URL] = Str(d)
If d > 0 Then Modus = d
Else
CLOSECOM
OpenString = "COM" + [login to view URL] + ":19200,N,8,1"
i = OPENCOM(OpenString)
DTR 1
RTS 1
TIMEINIT
CLEARBUFFER
SENDBYTE 11
d = READBYTE
If d > 0 Then
If d = 5 Then
Modus = 5
[login to view URL] = Str(d)
End If
End If
End If
End If
End Sub
Private Sub Command2_Click()
Neumodus = [login to view URL] + 1
If Neumodus = 0 Then Neumodus = 1
Text3 = Neumodus
If Modus < 5 Then
SENDBYTE 27
CLEARBUFFER
d = READBYTE()
DELAY 5
If d = 27 Then
SENDBYTE 10
d = READBYTE()
DELAY 5
SENDBYTE Neumodus
End If
End If
If Modus = 5 Then
CLEARBUFFER
SENDBYTE 10
d = READBYTE()
DELAY 5
SENDBYTE Neumodus
End If
If Modus = 5 Then OpenString = "COM" + [login to view URL] + ":19200,N,8,1"
If Modus < 5 Then OpenString = "COM" + [login to view URL] + ":9600,N,8,1"
End Sub
Private Sub Command4_Click()
OpenString = "COM" + [login to view URL] + ":9600,N,8,1"
i = OPENCOM(OpenString)
If i = 0 Then MsgBox ("Schnittstelle nicht verfügbar")
DTR 1
RTS 1
End Sub
Private Sub Command3_Click()
If Modus = 1 Then
CLEARBUFFER
DELAY 1000
d = READBYTE
L = (d - 50) / 2
If L < 0 Then L = 0
[login to view URL] = " " + Str$(L) + " dB(A)"
End If
If Modus = 2 Then
CLEARBUFFER
DELAY 1000
For n = 1 To 4
d = READBYTE
If d = 1 Then
d = READBYTE
L = (d - 50) / 2
If L < 0 Then L = 0
[login to view URL] = " " + Str$(L) + " dB(A)"
End If
Next n
End If
If Modus = 3 Then
CLEARBUFFER
DELAY 1000
d = READBYTE
L = (d - 50) / 2
If L < 0 Then L = 0
[login to view URL] = " " + Str$(L) + " dB(A)"
End If
If Modus = 4 Then
CLEARBUFFER
For n = 1 To 4
d = READBYTE
DELAY 1000
If d = 1 Then
d = READBYTE
L = (d - 50) / 2
If L < 0 Then L = 0
[login to view URL] = " " + Str$(L) + " dB(A)"
End If
Next n
End If
If Modus = 5 Then
CLEARBUFFER
SENDBYTE 48
d = READBYTE
L = (d - 50) / 2
If L < 0 Then L = 0
[login to view URL] = " " + Str$(L) + " dB(A)"
End If
End Sub
Private Sub Form_Load()
[login to view URL] "M 1, 1 Ch 1000 ms "
[login to view URL] "M 2, 2 Ch 1000 ms "
[login to view URL] "M 3, 1 Ch 600 ms "
[login to view URL] "M 4, 2 Ch 600 ms "
[login to view URL] "M 5, SIOS-kompatibel"
[login to view URL] = 0
Modus = 1
End Sub
Private Sub Form_Unload(Cancel As Integer)
CLOSECOM
End Sub
I've seen similar communications with other data acquisition boards where the protocol involves telling the device to expect instructions and then return data. I have a couple of Weeder Technology boards, WTAIN-M and WTDOT-M, connected to an Arduino Mega board. These boards require a message and address to be seen and then respond with data. I suspect that is similar to your board, hence the sendbyte command. Do you have a command and control protocol for that device to know what all the options are? Building a PERL program to use either Linux or Windows serial ports and send out hex data is trivial and converting those portions of the VB over shouldn't be too difficult but if some insight into the board is had perhaps something more can be done.
€23 EUR en 1 día
0,0 (0 comentarios)
0,0
0,0
5 freelancers están ofertando un promedio de €27 EUR por este trabajo
Hello
More 20 years programming experience.
I need more details to set real price and time.
Regards.
---------------------------------------------------------------------------------------------------------------------------------------------------
(((((((((((((PLEASE CHAT ME low budget i can help you ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
......................................................................................................................