Go to Post Haha, I applaud your efforts to read into the actions of the GDC, but I feel like trying to do so is like shooting at a target, in the dark, at a mile away, with a sawed off shotgun. - ttldomination [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 16-01-2003, 16:27
Goya Goya is offline
Registered User
#0019 (Big Red)
 
Join Date: Jan 2003
Location: Greenwich, CT
Posts: 35
Goya is an unknown quantity at this point
Send a message via AIM to Goya
Do ... Until ... Loop

The syntax I used for a Do .. until ... loop -

Do Until (sFront = 0)

'code

Loop

This creates an infinite loop that I cant get out of, even if sFront = 0. What gives?

In fact, I also tested to see if the value of sFront isn't changing with -

Do Until (sFront = 0)

If sFront = 0 then DEBUG "Im Trapped, Help Me!",CR

Loop

This debugs "Im Trapped, Help Me!"

Thanks in advance,
  #2   Spotlight this post!  
Unread 16-01-2003, 16:48
Goya Goya is offline
Registered User
#0019 (Big Red)
 
Join Date: Jan 2003
Location: Greenwich, CT
Posts: 35
Goya is an unknown quantity at this point
Send a message via AIM to Goya
Actually, I have a more specific question. As I was reading the documentation that came with PBASIC 2.5 I noticed that the Do ... While ... Loop needs a condition with the WHILE and UNTIL, whereas statements are used where the code is inserted.

Do While|Until conditions

'code
statements

Loop While|Until conditions

Question - What is the difference between a condition and a statement ? Can I use sFront = 0 as a condition?

Thanks again,
  #3   Spotlight this post!  
Unread 16-01-2003, 16:56
Goya Goya is offline
Registered User
#0019 (Big Red)
 
Join Date: Jan 2003
Location: Greenwich, CT
Posts: 35
Goya is an unknown quantity at this point
Send a message via AIM to Goya
Hey, I figured out why the code was not working to my liking. In my code, I used a SEROUT, but no SERIN. Remember, you need to use a SERIN to get input from the sensors! This goes to show what sleep deprivation does to people!
  #4   Spotlight this post!  
Unread 19-01-2003, 01:16
maDGag maDGag is offline
Registered User
#0334
 
Join Date: Dec 2002
Location: Brooklyn, NY
Posts: 14
maDGag is an unknown quantity at this point
perhaps, ur reassigning

sFont = 0 everytime u loop

mayb im wrong, how about some logical operators instead /

sFont == 0

meh ... forget me ... im still stuck in C++
  #5   Spotlight this post!  
Unread 19-01-2003, 02:46
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
No, == is not a valid operator in PBASIC.

Goya's third post hit the nail on the head: if you don't SERIN, you don't get any new data.

As for what makes an expression a condition is the presence of any of the following operators:

=
>(=)
<(=)
<>

Note that = can also be used for assignment. It's function is determined by the context in which it is used. For example:

if rc_sw1=1 then ...

uses = as a comparison operator, whereas

rc_sw1=1

uses = as the assignment operator.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #6   Spotlight this post!  
Unread 19-01-2003, 09:52
Hendrix Hendrix is offline
Registered User
#0538 (Dragon Slayers)
 
Join Date: Nov 2002
Location: Arab, AL
Posts: 44
Hendrix is an unknown quantity at this point
(sFront = 0)

that should just be sFront = 0

also before the main programming loop you should put sFront = 0 or something like that to tell pbasic what the value for it is...
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Actual execution time measurement Dan Technical Discussion 5 24-03-2003 11:36
How long is one stamp loop yangotang Programming 3 23-01-2003 20:36
NEED HELP with Delay loop for compressor relay switch archiver 2001 10 24-06-2002 02:11
Counter loop archiver 2001 3 24-06-2002 00:44
OK...so I'm totally out of the loop... Markfuscius 3D Animation and Competition 8 03-02-2002 02:39


All times are GMT -5. The time now is 04:27.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi