BasicMicroUK - Forums

www.basicmicro.co.uk
It is currently Sun Jul 22, 2018 9:45 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: how to repeat once using loop commands
PostPosted: Wed Nov 06, 2013 3:38 pm 
Offline
Guru

Joined: Sat Mar 30, 2013 10:19 pm
Posts: 51
Hi all, i have a action, routine, lcdwrite for example, that i want to run or repeat once. i have looked at the loop commands repeat-until, do-while etc... having looked at the syntax manual i dont know if they are the ones to use and how or is there a simple repeat x1 command. thanks in advance.


Top
 Profile  
 
 Post subject: Re: how to repeat once using loop commands
PostPosted: Wed Nov 06, 2013 8:39 pm 
Offline
Master

Joined: Wed Oct 19, 2011 2:28 am
Posts: 123
Hi,
I do not know if I understood what are you looking for but is you want to execute a command one time and it is repeat more than one in your program you can do something like this.

'Routine to out to the lcd display one time

'***********************************************
lcd_disp ' routine name
lcdwrite
return


program body
gosub lcd_disp 'goto output to the display routine
stop




'


Top
 Profile  
 
 Post subject: Re: how to repeat once using loop commands
PostPosted: Wed Nov 06, 2013 8:48 pm 
Offline
Guru

Joined: Sat Mar 30, 2013 10:19 pm
Posts: 51
Sorry to clarify, at the moment the command is in a 1 minute loop and it repeats 5 times until the minute is over, I only want it to run once. Thanks


Top
 Profile  
 
 Post subject: Re: how to repeat once using loop commands
PostPosted: Thu Nov 07, 2013 2:29 am 
Offline
Master

Joined: Wed Oct 19, 2011 2:28 am
Posts: 123
Hi,
If you one to do it 1 time 5 time in one minute then here it is a way to do it.


'This routine will repeat the lcdwriter 5 time in one minute.
'Using the pause 1000 = 1 sec 60/5 = 12 X1000 = 1 minute

loop var byte
main

lcd_display 'routine
for loop = 1 to 5 'repeat 5 times in 1 every 12 sec
lcdwrite 'Command
pause 12000 '1000 = 1 sec
next
return


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO