Micro-Second time delays... 
Author Message
 Micro-Second time delays...

Well, I feel I must also put in my $.02 for all of the "TIME DELAY"
post here and there.

I have provided a program that will allow an input time resolution
in Micro-Seconds...

'Program Starts Here!-----------------------------------

'Written for QBASIC or QuickBasic 4.5
'by: Beau Schwabe
'Note: use /L option with QB4.5

MACH$ = "558BEC5053515256578B5E088B178B5E0A8B0FB80086CD"
MACH$ = MACH$ + "158B5E0688275F5E5A595B588BE55DCA0600CC"
Prog1$ = ""
WHILE LEN(MACH$)
    Prog1$ = Prog1$ + CHR$(VAL("&H" + MID$(MACH$, 1, 2)))
    MACH$ = MID$(MACH$, 3)
WEND

Delay# = 1000000        'Micro-Seconds (uS)
                        '1000000 uS = 1 Second

'CONVERT Delay# value into its components n1% and n2% for
'the Assembly Program.
n1# = Delay# \ 65536
n2# = Delay# - (n1# * 65536)
IF n1# > 32767 THEN n1% = n1# - 65535 ELSE n1% = n1#
IF n2# > 32767 THEN n2% = n2# - 65535 ELSE n2% = n2#

Flag% = 0
WHILE Flag% = 0
      CALL absolute(n1%, n2%, Flag%, SADD(Prog1$))
      SOUND 2000, .1
WEND

'FLAG DEFINITIONS:

'Flag%=0        successful
'Flag%=1        ERROR
'Flag%=128      invalid command
'Flag%=131      wait already in progress
'Flag%=134      function not supported

'Program Ends Here!-----------------------------------

...use this program wisely!

CTRL-BREAK will not stop the Delay period, so watch your
Delay# values!

No Negative numbers either!

The Assembly program requires some time from the CPU
in order to process the CODE... Although only a few
uS this Delay is NOT accounted for.

Beau Schwabe



Sat, 19 Dec 1998 03:00:00 GMT  
 Micro-Second time delays...

Quote:

> Well, I feel I must also put in my $.02 for all of the "TIME DELAY"
> post here and there.

> I have provided a program that will allow an input time resolution
> in Micro-Seconds...

> 'Program Starts Here!-----------------------------------

> 'Written for QBASIC or QuickBasic 4.5
> 'by: Beau Schwabe
> 'Note: use /L option with QB4.5

> MACH$ = "558BEC5053515256578B5E088B178B5E0A8B0FB80086CD"
> MACH$ = MACH$ + "158B5E0688275F5E5A595B588BE55DCA0600CC"
> Prog1$ = ""
> WHILE LEN(MACH$)
>     Prog1$ = Prog1$ + CHR$(VAL("&H" + MID$(MACH$, 1, 2)))
>     MACH$ = MID$(MACH$, 3)
> WEND

> Delay# = 1000000        'Micro-Seconds (uS)
>                         '1000000 uS = 1 Second

> 'CONVERT Delay# value into its components n1% and n2% for
> 'the Assembly Program.
> n1# = Delay# \ 65536
> n2# = Delay# - (n1# * 65536)
> IF n1# > 32767 THEN n1% = n1# - 65535 ELSE n1% = n1#
> IF n2# > 32767 THEN n2% = n2# - 65535 ELSE n2% = n2#

> Flag% = 0
> WHILE Flag% = 0
>       CALL absolute(n1%, n2%, Flag%, SADD(Prog1$))
>       SOUND 2000, .1
> WEND

> 'FLAG DEFINITIONS:

> 'Flag%=0        successful
> 'Flag%=1        ERROR
> 'Flag%=128      invalid command
> 'Flag%=131      wait already in progress
> 'Flag%=134      function not supported

> 'Program Ends Here!-----------------------------------

> ...use this program wisely!

> CTRL-BREAK will not stop the Delay period, so watch your
> Delay# values!

> No Negative numbers either!

> The Assembly program requires some time from the CPU
> in order to process the CODE... Although only a few
> uS this Delay is NOT accounted for.

> Beau Schwabe


        I'm sure it's a good function, but it could be improved.  First off,
there is no need to PUSH AX, BX, CX, DX, ES, or DI in ML functions (that are
NOT ISR's).  You didn't PUSH ES or DI, but you DID push AX, BX, CX, and DX.  
Second, you don't need to MOV SP, BP at the end because your PUSH and POP
statements were balanced (good job!).  I hope you take these into
consideration.  Great program!

--
______________________________

Steven Sensarn

______________________________



Sun, 20 Dec 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Delay for Micro Second

2. Delay for Micro Second

3. Time in micro seconds

4. Sending a delayed email and have the time sent at the delayed time

5. Programming Microsecond Delays

6. micro second timer

7. micro second ping

8. Second to Hours, Minutes & Seconds Time Conversion

9. 10 second delay?

10. code to delay for 1 second its operation

11. Code signing template introduces ~5 second delay

12. How do I make a 0.2 second delay?

 

 
Powered by phpBB® Forum Software