1 / 14

Lecture 9

Lecture 9. - Synchronous Devices require a timing signal. Interval Timer. Clock generated. Microprocessor. Clk. Clk. PCLK =1.19318 MHz. Ch0 to IRQ0. Interval Timer. Clk. CH1 TO DRAM controller. PCLK (for peripheral Synchronous Devices). Ch2 to PC Speaker. Counter Registers:.

gitano
Download Presentation

Lecture 9

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 9

  2. - Synchronous Devices require a timing signal. Interval Timer Clock generated Microprocessor Clk Clk PCLK =1.19318 MHz Ch0 to IRQ0 Interval Timer Clk CH1 TO DRAM controller PCLK (for peripheral Synchronous Devices) Ch2 to PC Speaker

  3. Counter Registers: • Counter registers can be used to divide frequency. 7 6 5 4 3 2 1 0 count /16 /8 /4 /2

  4. 0000 1000 0000 1001 0000 1010 0000 1011 0000 1100 0000 1101 0000 1110 0000 1111 0000 0000 0000 0001 0000 0010 0000 0011 0000 0100 0000 0101 0000 0110 0000 0111

  5. Timing Diagram Bit 0 (/2) Bit 1 (/4) Bit 2 (/8) Bit 3 (/16) : : : : : : : : : : : : : : :

  6. Interval Timer Programming: Command Registers • 8-bit Command port • Need to be programmed before loading the divisor value for a channel. • 3 channels, each requires a 16-bit divisor value to generate the output frequency.

  7. 7 6 5 4 3 2 1 0 Binary = 0 BCD = 1 Ch: 00=0 01=1 10=2 Mode 0 ~ 5 =000 ~ 101 01=Low Byte 10=High Byte 11=Low Byte followed by High Byte

  8. Divisor = 4 Mode = 1 -----4----- -----4----- Divisor = 4 Mode = 2 -----3----- -----3----- Divisor = 4 Mode = 3 ---2--- ---2--- Divisor = 4 Mode = 4 -----4----- -----4-----

  9. Binary Count: count 1 0 0 0 1 0 1 0 1 0 0 0 1 0 1 1 BCD COUNT=89 1 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1 1 0 0 1 1 0 0 1 99= 0 0 0 0 0 0 0 0

  10. Ports & Channels: • 3-Channels 16-bit wide divisor value i.e 0~65535 8-bit port for each channel therefore the divisor word is loaded serially byte by byte. Port Addresses 43H = Command Port 40H = 8-bit port for Channel 0 41H = 8-bit port for Channel 1 42H = 8-bit port for Channel 2

  11. Programming Concepts for Interval Timer: • Load the Command byte into command register required to program the specific channel. • The divisor word is then Serially loaded byte by byte.

  12. 61H Port Connect to interval timer = 1 Rest of the bits are used by other devices and should not be changed. Turn ON Speaker = 1 Turn OFF Speaker=0

  13. Example: Program loads divisor value of 0x21FF Turns ON the speaker and connects it to Interval Timer #include<BIOS.H> #include<DOS.H> void main() { outportb (0x43,0xB4); outportb (0x42,0xFF); outportb (0x42,0x21); outportb (0x61,inportb(0x61) | 3); getch(); outportb (0x61,inportb(0x61) & 0xFC); }

  14. Timer Count: 40:6CH Incremented every 1/18.2 seconds. Whenever INT8 unsigned long int far *time = unsigned long int far*) 0x0040006C void main() { unsigned long int tx; tx = (*time); tx = tx +18; puts(“Before”); while((*time <= tx); puts(“After”); }

More Related