Maker Pro
Maker Pro

serial communication w/ the oopic microcontroler

A

Amperage

I've been having quite a bit of trouble getting the oopic
microcontroler to communicate with my computer. I have a LabView
program that sends a value, and the echo program provided with the
oopic compiler echos it properly (so im fairly sure that the problem
isnt on that end). The trouble comes when I try to make use of that
data.


I've currently modified the Anounce program that comes with the oopic
to beep a specific tone when it revieves a specific value. Its not
working, and strangely enough when I add in the code to echo I get junk

back.


I'm not very experienced with the oopic, and so have been very
frustrated by this problem.


this is the code im using...


'This is the program that is in
'the OOPic-R when it is shipped


Dim A As New oFreq
Dim B As New oDio1
Dim C As New oDio1
Dim D As New oDio1
Dim DataPass As New oSerial 'the serial port data
Dim PassValue As New oByte 'a holding value that stores serial
'data


Sub Main()
DataPass.Baud = cv9600
DataPass.Operate = cvTrue
B.IOLine = 7
C.IOLine = 6
D.IOLine = 5
B.Direction = cvOutput
C.Direction = cvOutput
D.Direction = cvOutput
B = 1
C = 1
D = 1
A.Beep(60000,10)
A.Beep(61000,10)
A.Beep(63000,10)
B.Direction = cvInput
C.Direction = cvInput
D.Direction = cvInput
Do
If DataPass.Received = cvTrue Then
PassValue.Value = DataPass.Value
DataPass.Value = DataPass.Value 'the echo code
If PassValue = 1 Then
A.Beep(5000,5)
A.Beep(51000,5)
End If
If PassValue = 2 Then
A.Beep(47000,5)
A.Beep(57000,5)
End If
If PassValue = 3 Then
A.Beep(64000,5)
A.Beep(51000,5)
End If
End If
Loop
End Sub
 
Top