It is currently Tue Feb 18, 2020 2:25 pm

All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Oct 06, 2010 2:57 pm 

Joined: Wed Oct 06, 2010 2:48 pm
Posts: 1
Location: Malaysia
i am not sure about the function of repeat- until used in the below code i found in the example of clockDigital program.
is this means that the section had to be repeated until a second elapse before it proceed to the other statement? why have to be coded like this?please help me about this.
i have try to run the code without this using repeat yet i found that the program is still run smoothly.

    move.l  a4,a2
        move.b  #8,d0   
        trap    #15

        if.l d1 <hs> #NOON then.s
            sub.l #NOON,d1  time = time - NOON
*       Calculate total minutes (D5), minutes this hour (D6), seconds (D7)
        divu    #100,d1     convert to seconds
        move.l  d1,d4       save fractional seconds
        andi.l  #$0000ffff,d1   discard fractional seconds
        divu    #60,d1      convert to minutes
        move.l  d1,d7
        move.l  #16,d0 
        lsr.l   d0,d7       d7 = seconds
        andi.l  #$0000ffff,d1   discard seconds from d1
        move.l  d1,d5       d5 = total minutes
        divu    #60,d1      convert to hours
        move.l  d1,d6
        move.l  #16,d0
        lsr.l   d0,d6       minutes this hour to d6
        swap    d4          display fractional seconds on LEDs
        move.b  d4,(a3)
    until.w d7 <ne> seconds     until a second has elapsed

 Post subject:
PostPosted: Wed Oct 06, 2010 3:21 pm 
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1116
The repeat/until section of this code is waiting for the next second to elapse before continuing with the rest of the code. If repeat/until is removed this program still works. It just means the rest of the code runs when it really doesn't need to. In some applications you might not want the rest of the code to run until a certain amount of time had elapsed.

Prof. Kelly

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 5 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

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group