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.

Tuesday, December 11, 2007

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

--- In oopic@yahoogroups.com, "Angelo" <mowens18@...> wrote:
>
> Hi all,
>
> I hope someone can help me with this problem... I have been
fighting
> with my ooPic for a week now with no luck :(
>
> Hardware:
> (1) ooPic-r
> (2) Devantech LCD03 (I2C)
> (3) Laptop with RS232 Serial Port
>
> Objective:
> Using Visual Basic 8 on a Laptop to transmit a short line of text
> (String) over the RS232 Serial Port that will be displayed on the
LCD
> on the ooPic-r
>
> Issues:
> Converting the output(byte?) from the ooPic's received buffer to a
> string to be displayed on the LCD
>
> Accomplished thus far:
> (1) Visual Basic 8 software to send a line of text and received and
> convert bytes on a line of text(string)
> (2) LCD03 setup
> (3) Convert to string to byte to send to LCD03
>
> Could someone please help me figure out how to convert the data
> coming from the serial port to a string that can be sent to the
LCD03?
>
> Regards,
> Angelo
>
> ooPic software thus far:
>
**********************************************************************
> Dim LCD03 As New oI2C 'I2C Setup for LCD03
> Dim LCDStr As New oBuffer20 'Buffer LCD String Conversion
> Dim Sch As New oByte 'Temp Byte Location for LCD String
> Dim SP As New oSerial 'Serial Port Setup for PC Communication
> Dim i As New Integer
> Dim j As New Integer
>
> Sub Main()
> ooPIC.Delay = 4000 'Initializaion delay
> 'Serial Port Configuration
> SP.Baud = cv9600 'Serial Port Baud Rate
> SP.Operate = cvTrue
> 'LCD03 Configuration
> LCD03.Node = 99 'I2C address for LCD03
> LCD03.Width = cv10Bit
> LCD03.Mode = cv10Bit
> LCD03.NoInc = cvTrue
> LCD03.Value = 12 'Clear LCD03 Screen
> LCD03.Value = 19 'Switch on LCD03 Screen
> LCD03.Value = 4 'Remove cursor on LCD03 Screen
> LCD03.Value = 12 'Clear LCD03 Screen
>
> Do
> LCD03.Value = 1 'Start at home position on LCD03 Screen
> 'String input to LCD03
> LCDStr.VString = "Test: " & Str$(j)
> j = j + 1
> 'Convert to Byte to send to LCD03
> For i = 0 To 20
> LCDStr.Location = i
> Sch.Value = LCDStr.Value
> LCD03.Value = Sch
> Next i
> Loop
> End Sub
>
*********************************************************************
>

You need to be in a loop where you look at the serial port - test the
Received property. When a char is received you can send it to the
LCD directly. Or, you can put it in an oBuffer but then you have to
maintain the pointer. You can use a head and tail pointer to create
a circular buffer if that is what you need.

Finally, when you get around to it, take the chars out of the buffer
and send them to the LCD.

Personally, I would send each received byte, one at a time, if that
would work for the project.

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: