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,
>
> All the code works and the test message is displayed on the LCD03.
>
> I have tried to implement the sugguested code but it does not seem to
> work. What comes up on LCD03 is not what I have transmitted but the
> return value to the PC confirms that the char sent is correct. The
> LCD03 shows a funny char that isnt even english.

OK, every time you receive a char, echo it to the PC but send 65 to
the LCD. This should print an 'A'.

Then, if that works, try:

ch = ch and 127 ' mask off high bit after grabbing from SP

See if that works better. Unfortunately, there is no table that shows
what the LCD will display for various inputs.

>
> The issue is that the LCD03 display is picking up data that is
> transmitted over the I2C/Serial 5pin Programming thing on the ooPic-
> r. For example if I have no program running and I transmit data to
> the oopic, the LCD03 picks up stuff being transmitted and displays
> char based on the ascii code.

This really shouldn't happen and it sounds like an electrical problem.
The EEPROM is at 8 bit address 0xA0 and the LCD is at 0xC6 so you
wouldn't expect them to collide.

How do you have the LCD connected? It probably shouldn't take +5V
from the programming header, particularly if there is a backlight.
Grab the +5 from one of the IOLine EPx pins.

>
> Are there any notes that I can read about how the ooPic-r
> transmits/receives data and how the buffer works.
>
> It would also be useful to understand how to convert
> decimal/hex/char/byte to string.

Binary byte or word to decimal string use STR$. All the other
conversions are ugly: You have to isolate the bits (say 4 bits for
hex), add '0' and if the result is greater than '9', add 'A' - '9'.

Google is your friend for these algorithms. They are all over the
place http://www.semsim.com/ccna/tutorial/binary-hex/numbers.html

Google for 'ASCII character table' to get the internal representation
for various chars.

Richard

>
> Thanks so much for your speedy reply.
>
> I have really been suffering to this to work...
>
> Regards,
> Angelo
>
> --- In oopic@yahoogroups.com, "rtstofer" <rstofer@> wrote:
> >
> > --- 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: