G
Gene Augustin
MAC Powerbook G4, OS 10.5.6
Office 2004, Excel 2004 Version 11.5.3
I have a macro provided by an equipment manufacturer. It is supposed to work
on MAC. Mfr no help. The macro crashes with message "Compile Error Expected
Identifier" and the code is highlighted in red as noted here:
Public Enum DAQ_states 'red
stopped = 0
running = 1
End Enum 'red
Public DAQ_state As daq_states, DAQ_counter As Long
'
'
If I use the immediate window and print stopped and running, they are 0 and
1 respectively.
Any suggestions on how to fix this code?
Here's the sub that uses the DAQ_states:
Public Sub DAQ_Procedure()
' Data Acquisition Procedure
Dim message As String, car As Byte
If DAQ_state = running Then
DAQ_counter = DAQ_counter + 1
' increment acquisiton sample counter
Worksheets(1).Range("B2") = DAQ_counter
' and display it inside spreadsheet in real time
Put #1, , "adc 1" + vbLf
' ask µChameleon for voltage on its adc input pin 1
message = ""
Do
' retreive answer on byte at a time
DoEvents
Get #1, , car
If car = Asc(vbLf) Then Exit Do
' until we see the end-of-line character
message = message & Chr(car)
Loop
words = Split(message)
' analyse answer - syntax should be : adc 1 <value>
Worksheets(1).Cells(DAQ_counter, 4) = Val(words(2))
' add measured value in column D, in successive rows
If DAQ_counter >= 60 Then DAQ_state = stopped
' do that for a minute
Application.OnTime Now + TimeValue("00:00:01"), "DAQ_Procedure"
' launch next acquisiton in one second
Else
Put #1, , "led pattern 254" & vbLf
' set activity led back to its default pattern so we know it stopped
Close #1
' and close communications port
End If
End Sub
Office 2004, Excel 2004 Version 11.5.3
I have a macro provided by an equipment manufacturer. It is supposed to work
on MAC. Mfr no help. The macro crashes with message "Compile Error Expected
Identifier" and the code is highlighted in red as noted here:
Public Enum DAQ_states 'red
stopped = 0
running = 1
End Enum 'red
Public DAQ_state As daq_states, DAQ_counter As Long
'
'
If I use the immediate window and print stopped and running, they are 0 and
1 respectively.
Any suggestions on how to fix this code?
Here's the sub that uses the DAQ_states:
Public Sub DAQ_Procedure()
' Data Acquisition Procedure
Dim message As String, car As Byte
If DAQ_state = running Then
DAQ_counter = DAQ_counter + 1
' increment acquisiton sample counter
Worksheets(1).Range("B2") = DAQ_counter
' and display it inside spreadsheet in real time
Put #1, , "adc 1" + vbLf
' ask µChameleon for voltage on its adc input pin 1
message = ""
Do
' retreive answer on byte at a time
DoEvents
Get #1, , car
If car = Asc(vbLf) Then Exit Do
' until we see the end-of-line character
message = message & Chr(car)
Loop
words = Split(message)
' analyse answer - syntax should be : adc 1 <value>
Worksheets(1).Cells(DAQ_counter, 4) = Val(words(2))
' add measured value in column D, in successive rows
If DAQ_counter >= 60 Then DAQ_state = stopped
' do that for a minute
Application.OnTime Now + TimeValue("00:00:01"), "DAQ_Procedure"
' launch next acquisiton in one second
Else
Put #1, , "led pattern 254" & vbLf
' set activity led back to its default pattern so we know it stopped
Close #1
' and close communications port
End If
End Sub