This Forum is Dedicated For all The Object Oriented PIC Lovers .......... The concept behind OOPic is straight forward. Use preprogrammed multitasking Objects from a library of highly optimized Objects to do all the work of interacting with the hardware. Then write small scripts in Basic, C, or Java syntax styles to control the Objects. During operation, the Objects run continuously and simultaneously in the background while the scripts run in the foreground telling the objects what to do.

Thursday, September 20, 2007

[oopic] Re: Serial communication between two oopics

Working to get each OOPic talking to the PC as a first step towards
getting them to talk to each other was good advice. Thanks.

I used oSerialPort and wrote code to spew characters serially and I
can see that through the comm window. On the other one wrote code
that echoed back everything it received but that beeped and flashed
an LED everytime it received the ascii value of the character 'D'.
After making sure they both worked in talking with a PC, I ran a wire
between the two DB9 serial ports of the OOPics (oopic-r and oobot-
40II) as follows:

pin5 <-> pin5
pin2 <-> pin3
pin3 <-> pin2

Once done, I got regularly beeps and flashes from the receiving end
when it detects a 'D' amongst the pile of characters coming from the
sender.

More work to do before it does what I need it to do, but at least
they are communicating. My project has now grown to where I'll have
one oopic separated from another by some distance and then a third
oopic connected via i2c in close proximity to the first (simply
because I have two many objects to store in one on that end).

Thanks again for pointing me in the right direction.

--- In oopic@yahoogroups.com, Andrew Porrett <slicerwizard@...> wrote:
>
> At 07:52 AM 8/21/2007, msmith98990 wrote:
> >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)
>
> Did you also connect a ground wire?
>
>
> >Sub Main()
> > LED.IOLine = 7
>
> No delay at startup can be dangerous when playing with serial I/O.
>
>
> > LCD.String = Str$(S.Value)
>
> LCD = S should be sufficient. You are after all just dealing with
ASCII bytes.
>
>
> >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.
>
> Hm. Something's borked.
>
>
> >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.
>
> Sounds like it's doable. I get the impression that you want the
two
> OOPics to act as peers rather than a master/slave
> relationship. Could get tricky.
>
>
> >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?
>
> Certainly.
>
>
> > 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?
>
> Sending strings between OOPics guarantees that you will lose data,
> since the RX buffers can only hold four bytes.
>
> Since you have an OOPic-R, why don't you work on your serial mojo
by
> communicating between it and your PC first? E.g. get what you send
> from your PC to echo back to the PC as well as display on the LCD.
>
>
> ...Andy
>



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/

No comments: