Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Programming the Timer 8253

Posted on 1997-08-21
7
Medium Priority
?
561 Views
Last Modified: 2008-03-10
I want to know how to program the 8253 timer on port 40h-43h. So that I can implement this to the joystick reading procedures, use it as a delay... Everywhere where the timing or delays are needed
0
Comment
Question by:Kasumi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 2

Accepted Solution

by:
alona041797 earned 600 total points
ID: 1215444
You should write an interrupt handler for interrupt 8 as following:

Uses Dos {,...};

var defint8:procedure;
   
procedure myint8; interrupt;
  begin
    {Whatever you need to be run 18.2 times per second}
    inline($9C);
    defint8;
  end;

{...}

begin {Main Program}
  {...}
  getintvec(8,@defint8);
  setintvec(8,@myint8);
  {...Most of your program here...}
  setintvec(8,@defint8);
end. {Main Program}

{Hope this helps...}
0
 

Author Comment

by:Kasumi
ID: 1215445
Well this isn't that hard for me to figure uot by myslef. But I wanted to know HOW to write the handler for it. I mean I want to replace the interrup by my own function.
I don't want to call the int at all.
So let's say that one of the things the interrupthas to do, is increasing the time counter on 0000h:046ch.
So I want to know how to do this.
My guess:
mov dx,40h
insd eax,dx
xor bx,bx
mov es,bx
mov edi,046ch
mov dword ptr es:[edi],eax
I want mz function to replace the int. It desn't need to have EVERYTHING the timerinterrupt has, but the basic functions should be included.

0
 
LVL 2

Expert Comment

by:alona041797
ID: 1215446
Why should you replace the original handler?
The assembler code you wrote will correctly update the timer, which is the most important thing the hardware interrupt does.
BUT, If you intend to write your own handler you must acknowledge the interrupt by:
  port[$20]:=$20;
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:Kasumi
ID: 1215447
Ok. I hate interrupts. They are too slow. And it's a problem in Protected Mode always to warp the int into the 31h.
I want to know, how to use the ports. The ports for the timer
are 40h-43h but I don't know, what info in each port is. Thats what I want to have. A kind of documentation.
So that I know, what I have in each port, how can I set it etc.

Bye


0
 

Author Comment

by:Kasumi
ID: 1215448
I forgot:
$Why the port[$20]=$20??
0
 
LVL 2

Expert Comment

by:alona041797
ID: 1215449
I have exact docmentation of the ports of the 8253, but to use it you MUST use interrupts! The 8253 channel 0 generates int 8, channel 1 refreshes the DRAM and channel 2 is for the PC speaker... you *can* start it counting and check its value by using channel 2. Please post your e-mail address or send it to me <alon.a@usa.net> for that file.
0
 
LVL 2

Expert Comment

by:alona041797
ID: 1215450
The port[$20]:=$20 tells the hardware interrupt manager that the hardware interrupt has been acknowledged, so it can send more hardware interrupts of the smae kind.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
What we learned in Webroot's webinar on multi-vector protection.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question