Home Random Page


CATEGORIES:

BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism






System timer.

Since IBM AT, personal computers contain two devices for management of processes —real time clock (RTC) and actually system timer. Real time clock receives a food from the accumulator on the motherboard and works even then when the computer is switched off. This device can be used for definition/installation current date and time, alarm clock installation for the purpose of performance of any actions and for a call of interruption of IRQ8 (INT 4Ah) each millisecond. The system timer is used at the same time for management of the controller of direct access to memory, for management of the loudspeaker and as the generator of impulses causing interruption of IRQ0 (INT 8h) 18,2 times a second. The timer gives rich opportunities for reprogramming at the level of Input-Output ports, but at the level of DOS and BIOS and a real time clock, and the system timer are used only as means of definition/installation of the current time and the organization of delays. Function 2Ah — Determine date Input: AX = 2Ah Output: ÑÕ = year (1980 – 2099) DH = month DL = day AL = week day (0 — Sunday, 1 — Monday...) Function 2Ch — Determine time Input:

AX = 2Ch

Output: ÑÍ = hour

CL = minute

DH = second

DL = 100-th fraction of a second This function uses the system timer so time changes only 18,2 times a second and number in DL increases at once on 5 or 6. Function 2Bh — Establish date Input: ÀÍ = 2Bh

ÑÕ = year (1980 – 2099)

DH = month

DL = day Output: ÀÍ = FFh, if nonexistent date is entered,

ÀÍ = 00h, if date is established

 

INT 1Ah ÀÍ = 05h — Establish RTC date

Input: ÀÍ = 05h

ÑÕ = year (in the BCD format)

DH = month

DL = day

INT 1Ah ÀÍ = 03h — Establish RTC time Input:

ÀÍ = 03h

ÑÍ = hour (in the BCD format)

CL = minute (in the BCD format)

DH = second (in the BCD format)

DL = 01h, if summertime is used, 0 — otherwise

Besides, BIOS allows using RTC for the organization of alarm clocks and delays: INT 1Ah ÀÍ = 06h — Establish an alarm clock Input:

ÀÍ = 06h

ÑÍ = hour (BCD)

CL = minute (BCD)

DH = second (BCD)

Output: CF = 1, if there was a mistake (an alarm clock is already established or interruption is caused at the time of updating of hours) CF = 0, if an alarm clock is established Now each 24 hours when time will coincide with the set one, a real time clock will cause interruption of IRQ8 (INT 4Ah) which the program which has established an alarm clock has to process. If by CH call = FFh, CL*nbsp; = FFh, and DH = 00h, then the alarm clock will start working once a minute. INT 1Ah ÀÍ = 07 — Cancel an alarm clock Input: ÀÍ = 07hThis function allows canceling an alarm clock, for example establishing it for other time.BIOS traces each counting of the system timer by means of the handler of interruption of IRQ0 (INT 8h) and increases by 1 value of the 32-bit counter which locates in memory at the address 0000h:046Ch, and at overflow of this counter of bytes to the address 0000h:0470h increases on 1. INT 1Ah ÀÍ = 00h — Read out the value of the time counter Input: ÀÍ = 00h Output: CX:DX = value of the counter AL = byte of overflow of the counter INT 1Ah ÀÍ = 01h — Change the value of the time counter Input: ÀÍ = 01h CX:DX = value of the counterThe program can read out value of this counter in a cycle (through interruption or simply the MOV command) and organize delays, for example while the counter won't increase on 1. But as this counter uses system timer, the minimum delay will be equal to about 55 microseconds. Frequency of the timer can be changed, programming it at the level of ports, but BIOS provides for this purpose special functions. INT 15h ÀÍ = 86h — Delay formation Input:ÀÍ = 86h CX:DX = delay duration in microseconds (million fractions of a second!) Output: AL = the mask which has been written down by the handler in the register of interruption management CF = 0, if the delay is executed CF = 1, if the timer was occupied If it is necessary to start the counter of time and to continue implementation of the program, it is possible to use one more function. INT 15h ÀÍ = 83h — Start the time counter Input: ÀÍ = 83h



AL = 0 — start the counter

AL = 1 — interrupt the counter

CX:DX = delay duration in microseconds ES:BX = the byte address, which high bit upon termination of the counter work will be established in 1 Output: AL = the mask which has been written down by the handler in the register of interruption management CF = 0, if the delay is executed CF = 1, if the timer was occupied The minimum interval for these functions on the majority of systems usually makes about 1000 microseconds.

 

 


Date: 2015-01-29; view: 1081


<== previous page | next page ==>
Work with a mouse. | Services. Dispatcher of management of services.
doclecture.net - lectures - 2014-2024 year. Copyright infringement or personal data (0.006 sec.)