Sign in

username:

password:



Not a member?

Search oopic



Search tips

Subscribe to oopic



Ads

Discussion Groups

Discussion Groups | | yet another problem with events... urgent

yet another problem with events... urgent - "rauli.karki" - Jun 16 7:45:49 2008

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



(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )


Re: yet another problem with events... urgent - rtstofer - Jun 16 10:16:34 2008

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 o...@yahoogroups.com, "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
>

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



(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )

need help with my project - ray xu - Jun 16 15:47:33 2008

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

r...@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]
------------------------------------



(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )

Re: yet another problem with events... urgent - tinslwc - Jun 17 2:25:41 2008

--- In o...@yahoogroups.com, "rtstofer" wrote:
>
> 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.

You will have to recalculate the event code location after you insert
the patch code. Also, I think that you have to separate the high and
low byte of the address. I usually try to keep my event code address
less than 256 to avoid this. If you move the event subroutine to the
top of the program (above Main) this should not be an issue and it
has the added benefit of not changing everytime you change the
program. It will change if you add or remove objects...they always
come first.

>
> 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 o...@yahoogroups.com, "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
>
------------------------------------



(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )

Re: yet another problem with events... urgent - tinslwc - Jun 17 2:27:43 2008

--- In o...@yahoogroups.com, "rtstofer" wrote:
>
> 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.

You will have to recalculate the event code location after you insert
the patch code. Also, I think that you have to separate the high and
low byte of the address. I usually try to keep my event code address
less than 256 to avoid this. If you move the event subroutine to the
top of the program (above Main) this should not be an issue and it
has the added benefit of not changing everytime you change the
program. It will change if you add or remove objects...they always
come first.

>
> 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 o...@yahoogroups.com, "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
>
------------------------------------



(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )