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.

Wednesday, December 12, 2007

[oopic] Re: Help with incoming Serial Communcation from PC to ooPic-R I2c LCD03

--- In oopic@yahoogroups.com, "Angelo" <mowens18@...> wrote:
>
> Hi Richard,
>
> Thanks for your help!
>
> I have attempted to use your suggested method about send the data
> directly to the LCD but this has not worked. The code I used is as
> follows:
> If SP.Received Then
> LCD03 = SP
> End If
>
> I do not know enough about obuffer and how the serial port receives
> data to be able to get it work. I have tried some conbinations but
> nothing has worked. Could you assist with some sample code to help me
> on my way?
>
> Regards,
> Angelo

I'm lost... How much of the code you posted actually works? Does the
string "Test" actually wind up on the LCD?

If you ONLY problem is getting chars from the SP then something like:

dim ch as byte
dim i as byte
dim b as oBuffer20

i = 0 ' buffer index is zero based
do
if SP.Received then
ch = SP.Value 'save the char, we can't come back to SP.Value
SP.Value = ch 'send it back to the PC so it can be checked
LCD03 = ch 'send it to the LCD
b.location = i 'b.location can be automatic (not used)
b.value = ch ' put in buffer
i = i+1 ' update pointer
end if
loop

I have taken the received char and sent back out the serial port, sent
it to the LCD and stuffed it in a buffer. You can choose any or all
of these options and junk what is unnecessary.

Clearly the buffer will overflow eventually, I don't know why you
want to buffer the chars but you need to manage it somehow. You can
use the .Width property to find the highest valid index and, rather
than setting the pointer to i = i + 1, set it back to zero if it is
already equal to the .Width value. If you want a circular buffer...

The code above is 'pseudo' code in that it hasn't been checked. It is
just for reference.

Richard


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: