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.

Monday, June 16, 2008

[oopic] need help with my project

Hi, since now I've got the LCD working, I have a problem with the timing.
I'm building a project where it uses ultrasound to measure distance. It's a
lot like the SRF04, but I'm using an oopic-R, NE555 (as transmitter), and a
different receiver. The basic concept is that the oopic will enable the 555
to transmit a 40-kHz pulse out, start the timer (oTimer, internal clock),
and once received back, stop the timer and display the results on the LCD.
So far, I've used the oMath, oflipflop, oSonarDV, and the code out of the
oopic book for oopic-1 to enable/disable oTimer. None has worked. Note:
when the receiver receives a signal, the output swings to logic high, if
there is no signal, its logic low. For the transmitter, logic high will
enable the 555; a logic low will disable it.

This is not very urgent, but I do have a due date of next school year (Aug.
25; I'm going to enter it into the science fair), and I'm barely half done
with the entire project. I've been trying to resolve this for a while now.
Thanks to all.

Here's my current code:

oLCD Print = New oLCD;

oTimer TICS = New oTimer;

oDIO1 Echo = New oDIO1; // receive line

oWire Conn = New oWire;

oDIO1 Trigger = New oDIO1; // transmit line

oFlipFlop Math = New oFlipFlop;

oBit Operate = New oBit;

// Indicator

oDIO1 trans = New oDIO1;

oDIO1 rec = New oDIO1

oWire transW = New oWire;

oWire recW = New oWire;

Void main(Void)

{

// Sets up LCD

Print.IOGroup = 3;

Print.Nibble = 1;

Print.IOLineE = 14;

Print.IOLineRS = 15;

Print.Operate = cvTrue;

Print.Init;

Print.Clear;

// sonar I/O and timer

TICS.PreScale = 0;

TICS.Operate = cvFalse;

TICS = 0;

Echo.IOLine = 18;

Echo.Direction = cvInput;

Trigger.IOLine = 27;

Trigger.Direction = cvOutput;

Trigger = 0;

Conn.Input.Link(Operate);

Conn.InvertIn = cvTrue;

Conn.Output.Link(TICS.Operate);

Conn.Operate = cvFalse;

// Set up indicator (for debugging)

trans.IOLine = 5;

trans.Direction = cvOutput;

rec.IOLine = 6;

rec.Direction = cvOutput;

transW.Input.Link (Trigger);

transW.Output.Link (trans);

transW.Operate = cvTrue;

recW.Input.Link (Echo);

recW.Output.Link (rec);

recW.Operate = cvTrue;

// Set up math

Math.Input1.Link (Echo);

Math.Input2.Link (Trigger);

Math.Output.Link (Operate);

ooPIC.Delay = 200;

While (1)

{

ooPIC.Delay = 100;

Math.Operate = cvTrue;

Conn.Operate = cvTrue;

TICS = 0;

Trigger = 1;

ooPIC.Delay = 20;

Trigger = 0;

If (Echo == 0)

{

Math.Operate = cvFalse;

Conn.Operate = cvFalse;

Print.VString = Str$(TICS.Count);

ooPIC.Delay = 100;

Print.Clear;

}

Print.Clear;

}

}

_________________________

Ray Xu

rayxu@tx.rr.com

No virus found in this incoming message.
Checked by AVG.
Version: 8.0.100 / Virus Database: 270.3.0/1505 - Release Date: 6/16/2008
7:20 AM


[Non-text portions of this message have been removed]


------------------------------------

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/

[oopic] Re: Serial To LCD messing up

--- In oopic@yahoogroups.com, Andrew Porrett <slicerwizard@...> wrote:

> If you're seeing multiple input sequences on your LCD, either your PC
> is somehow sending the old data along with the new data (unlikely if
> you're just using a simple terminal emulator program), or the
> previously displayed data on the LCD isn't being cleared properly.
>
> We're not there - you are. You'll have to figure out which of these
> two possibilities is the culprit.
>
>
> ...Andy
>

Even when I output the data to serial it repeats. What am I doing
wrong and how do I clear that old data?


------------------------------------

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/

[oopic] Re: yet another problem with events... urgent

I see where you have defined HOW to patch the code with the constants
and such but I don't see WHERE you installed the patch.

See message 37874 (and the rest of the thread).

I would DIM the oEvent first just to get a low address - not that it
matters.

If it still doesn't work after the patch is properly applied, you will
just have to wait for the revised compiler. Or find another way to do
the project.

Richard


--- In oopic@yahoogroups.com, "rauli.karki" <rauli.karki@...> wrote:
>
> I have this kind of code and i can't get it work. Main-prosedure is
> working fine but when i launch event all outputs changes condition and
> then it takes while when board resets itself... Oopic III+ C1.1+
>
> Dim Valo1 As New oDIO1 (26,cvOutput)
> Dim Valo2 As New oDIO1 (28,cvOutput)
> Dim Valo3 As New oDIO1 (11,cvOutput)
> Dim Valo4 As New oDIO1 (13,cvOutput)
> Dim Valo5 As New oDIO1 (14,cvOutput)
>
> Dim Pun As New oButton
> Dim Vih As New oButton
> Dim Kyt As New oButton
>
> Dim A As New oEvent
> Dim D As New oDIO1
> Dim W As New oWire
>
> ' I have tried this fix but it didnt help...
> Dim RAM_Access3 As oRAM
> Const Event_Obj_Location3 = 332 ' oEvent "Event" memory location
> Const EventCode_Location_Hi3 = 1 ' Event_Code EEPROM location High
> Const EventCode_Location_Lo3 = 76 ' Event_Code EEPROM location Low
>
>
> Sub Main()
> Pun.IOLine = 16
> Vih.IOLine = 4
> Kyt.IOLine = 18
>
> D.IOLine = 1
> D.Direction = cvInput
> W.Input.Link(D)
> W.Output.Link(A.Operate)
> W.InvertIn = cvTrue
> W.Operate = cvTrue
>
> Valo5 = 0
> ooPIC.Delay = 1000
> Sekvenssi
> Valo5 = 1
>
> Do
> If Kyt = 0 Then
> If Pun = 0 Then
> Sekvenssi
> End If
> End If
>
> If Kyt = 1 Then
> If Pun = 0 Then
> Valo1 = 0
> Valo2 = 0
> Valo3 = 0
> Valo4 = 0
> ' Valo5 = 0
> ooPIC.Delay = 100
> End If
> If Vih = 0 Then
> Valo1 = 1
> Valo2 = 1
> Valo3 = 1
> Valo4 = 1
> ' Valo5 = 1
> ooPIC.Delay = 100
> End If
> End If
> Loop
>
> End Sub
>
> Sub Sekvenssi
> Valo1 = 0
> ooPIC.Delay = 1000
> Valo2 = 0
> ooPIC.Delay = 1000
> Valo3 = 0
> ooPIC.Delay = 1000
> Valo4 = 0
> ooPIC.Delay = 1500
> Valo1 = 1
> Valo2 = 1
> Valo3 = 1
> Valo4 = 1
> End Sub
>
> Sub A_Code()
> Do Until Vih = 0
> Valo5.Value = ooPIC.Hz1
> Loop
> ooPIC.Delay = 500
> Valo5 = 1
> End Sub
>

------------------------------------

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/

[oopic] yet another problem with events... urgent

I have this kind of code and i can't get it work. Main-prosedure is
working fine but when i launch event all outputs changes condition and
then it takes while when board resets itself... Oopic III+ C1.1+

Dim Valo1 As New oDIO1 (26,cvOutput)
Dim Valo2 As New oDIO1 (28,cvOutput)
Dim Valo3 As New oDIO1 (11,cvOutput)
Dim Valo4 As New oDIO1 (13,cvOutput)
Dim Valo5 As New oDIO1 (14,cvOutput)

Dim Pun As New oButton
Dim Vih As New oButton
Dim Kyt As New oButton

Dim A As New oEvent
Dim D As New oDIO1
Dim W As New oWire

' I have tried this fix but it didnt help...
Dim RAM_Access3 As oRAM
Const Event_Obj_Location3 = 332 ' oEvent "Event" memory location
Const EventCode_Location_Hi3 = 1 ' Event_Code EEPROM location High
Const EventCode_Location_Lo3 = 76 ' Event_Code EEPROM location Low


Sub Main()
Pun.IOLine = 16
Vih.IOLine = 4
Kyt.IOLine = 18

D.IOLine = 1
D.Direction = cvInput
W.Input.Link(D)
W.Output.Link(A.Operate)
W.InvertIn = cvTrue
W.Operate = cvTrue

Valo5 = 0
ooPIC.Delay = 1000
Sekvenssi
Valo5 = 1

Do
If Kyt = 0 Then
If Pun = 0 Then
Sekvenssi
End If
End If

If Kyt = 1 Then
If Pun = 0 Then
Valo1 = 0
Valo2 = 0
Valo3 = 0
Valo4 = 0
' Valo5 = 0
ooPIC.Delay = 100
End If
If Vih = 0 Then
Valo1 = 1
Valo2 = 1
Valo3 = 1
Valo4 = 1
' Valo5 = 1
ooPIC.Delay = 100
End If
End If
Loop

End Sub

Sub Sekvenssi
Valo1 = 0
ooPIC.Delay = 1000
Valo2 = 0
ooPIC.Delay = 1000
Valo3 = 0
ooPIC.Delay = 1000
Valo4 = 0
ooPIC.Delay = 1500
Valo1 = 1
Valo2 = 1
Valo3 = 1
Valo4 = 1
End Sub

Sub A_Code()
Do Until Vih = 0
Valo5.Value = ooPIC.Hz1
Loop
ooPIC.Delay = 500
Valo5 = 1
End Sub


------------------------------------

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/

Sunday, June 15, 2008

Re: [oopic] Re: Serial To LCD messing up

At 12:57 AM 6/16/2008, ef721 wrote:
>I think the problem might be something that keeps on storing but not
>clearing.

If there is, it's not in the OOPic.


> Maybe some array or something ,

You're not using any arrays.


> or perhaps the serial buffer
>is storing past numbers sent.

No, it doesn't do that.


> Anybody have any clue how to clear those
>things , and what exactly needs to be cleared.

If you're seeing multiple input sequences on your LCD, either your PC
is somehow sending the old data along with the new data (unlikely if
you're just using a simple terminal emulator program), or the
previously displayed data on the LCD isn't being cleared properly.

We're not there - you are. You'll have to figure out which of these
two possibilities is the culprit.


...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/

[oopic] Re: Serial To LCD messing up

--- In oopic@yahoogroups.com, David Warner <bimityedye@...> wrote:
>
>
> Nope Sorry I see you did read the serial value!
>
> --- On Sun, 6/15/08, ef721 <ef721@...> wrote:


I think the problem might be something that keeps on storing but not
clearing. Maybe some array or something , or perhaps the serial buffer
is storing past numbers sent. Anybody have any clue how to clear those
things , and what exactly needs to be cleared.

Thanks guys , appreciate it


------------------------------------

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/

Re: [oopic] Serial To LCD messing up

Nope Sorry I see you did read the serial value!

--- On Sun, 6/15/08, ef721 <ef721@yahoo.com> wrote:

From: ef721 <ef721@yahoo.com>
Subject: [oopic] Serial To LCD messing up
To: oopic@yahoogroups.com
Date: Sunday, June 15, 2008, 3:10 AM


I am passing a string of numbers to an ooPIC-R through a serial port
and having it display the numbers on a serial LCD. The first time it
gets the string it displays the number correctly. But the second time
it will first show the first string number it received from before and
then show the second string number it received now. Here is my code:
The string of numbers I send from the PC is in the format #xx , e.g.
#12 or #48.
Thank you so much for your help!

,Eric

LCD As oLCDSE
Serial As oSerialH
X As oByte
Y As oByte
total As Byte
X=0
Y=0
total=0

LCD.IOLine = 16
LCD.Baud = cv9600
LCD.Clear
Serial.Operate = cvOn
Serial.Baud = cv9600

Start:
If Serial.Received = cvTrue And Serial.Value = 35 Then
LCD.VString = "got #"
Goto FirstDigit
EndIf
Goto Start

FirstDigit:
If Serial.Received =cvTrue Then
X= Serial.Value
X = X - 48
LCD.Clear
LCD.VString = "got 1st digit: "
LCD.VString = Str$(X)
Goto SecondDigit
EndIf
Goto FirstDigit

SecondDigit:
If Serial.Received = cvTrue Then
Y = Serial.Value
Y = Y - 48
LCD.VString = "got 2nd digit: "
LCD.VString = Str$(Y)
Goto ProcessTones
EndIf
Goto SecondDigit

ProcessTones:
LCD.Clear
total = (X*10 +Y)
LCD.VString = Str$(total)
Serial.VString = Str$(total)
Delay = 2000
LCD.Clear
LCD.VString = " Ready "

Goto Start


[Non-text portions of this message have been removed]


------------------------------------

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/