Hello everyone. I have an OOPic-R and an OOPic-S and have been
trying to get them to successfully talk to each other via serial.
Both boards will need to send and receive data at regular intervals.
I'm hoping that someone out there has had success with this, would be
willing to verify what I've learned so far and point out where I'm
going wrong.
Initially I tried using oSerialX because it allowed you to use
arbitrary I/O lines instead of I/O lines 22 and 23. I did this
because I had a hard time finding those two lines on the OOPic-R.
I've since read that they can be found on the underside of the board -
3 pads located under the DB9 connector - line 23 being on the left
and line 22 being on the right.
Armed with this knowledge, I connected what I believe is line 23
(serial Rx) of the OOPic-R to line 22 (serial Tx) of the OOPic-S (pin
37 on the 40 pin connector) and line 22 (serial Tx) of the OOPic-R to
line 23 (Serial Rx) of the OOPic-S (pin 39 of the 40 pin connector)
I wasn't able to find a full send and receive example, but took the
most usable one I found and modified it to simply tell me if the
received property of the oSerialPort object is getting set and print
the incoming data to the LCD:
Dim S As New oSerialPort
Dim W As New oWire
Dim LCD As New oLCDSET
Dim LED As New oLED
Sub Main()
LED.IOLine = 7
LED.TurnOn
LED.Operate = 0
LCD.IOLine = 16
LCD.Serial.Baud=3
LCD.Operate=1
LCD.String="Serial Port Test"
ooPIC.Delay=100
LCD.Clear
S.Baud = cv9600
S.Operate = cvTrue
W.Input.Link(S.Received)
W.Output.Link(LED.Operate)
W.Operate = cvTrue
S.Value = "Hello"
Do
If S.Received Then
LCD.String = Str$(S.Value)
End If
Loop
End Sub
As I understand it, S.Received gets set when incoming data arrives.
Since this program is running on both OOPics, they both should be
sending "Hello" on startup, their LEDs connected to IO line 7 should
light up briefly and the one with the LCD connected should show what
it received, and then the LED should turn off as soon as the data is
read. I realize whichever one starts up second will not likely
receive the message since it is only sent once, but I would think
that the first one up should receive it from the one that is powered
up second.
What happens is that the OOPic-R never seems to have received
anything (no LED and no LCD output) while the OOPic-S flashes it's
LED on and off a couple times per second. What's wierd is it does
that even when I disconnect the serial lines.
If I can get this working, I'm assuming the next step is to introduce
some flow control by dim'ing a couple of oDio1 lines on each,
connecting one pair of them for a clear to send signal for the OOPic-
R to know when it can send data, and the other pair so that the OOPic-
S knows when it can send. The CTS lines would be owire'd to the
S.Received property so that it changes from high to low when data is
received to prevent the sender from sending more data until the
receiver has read in what it has already received. And I would
probably set it up to be event driven rather than using any loop.
Am I anywhere close here? I would appreciate any help, including
tips on troublshooting this one thing at a time. For example, is it
possible to have a single OOPic talk to itself by connecting it's own
line 22 to it's own line 23 to verify that it can send and receive
data? And when the data is sent as a string, is it received in such
a way that a lcd.string=str$(s.value) would even work, or is that
going to produce ASCII numbers for just the first character?
Thanks to anyone who can chime in on this issue.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/oopic/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/oopic/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/