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/