| データシートサーチシステム |
|
HT95R45 データシート(PDF) 21 Page - Holtek Semiconductor Inc |
|
|
|||||||||||||||||||||||||||||
HT95R45 データシート(HTML) 21 Page - Holtek Semiconductor Inc |
|
21 / 76 page ![]() HT95R45 Rev. 1.00 21 March 12, 2010 PE, PF and PG, are first programmed. Selecting which pins are inputs and which are outputs can be achieved byte-wide by loading the correct values into the appro- priate port control register or by programming individual bits in the port control register using the ²SET [m].i² and ²CLR [m].i² instructions. Note that when using these bit control instructions, a read-modify-write operation takes place. The microcontroller must first read in the data on the entire port, modify it to the required new bit values and then rewrite this data back to the output ports. Port A has the additional capability of providing wake-up functions. When the device is in the Power Down Mode, various methods are available to wake the device up. One of these is a high to low transition of any of the Port A pins. Single or multiple pins on Port A can be setup to have this function. Timer/Event Counters The provision of timers form an important part of any microcontroller, giving the designer a means of carrying out time related functions. The device contains three count-up timers of 16-bit capacity. Timer0 and Timer1 have three different operating modes, they can be con- figured to operate as a general timer, an external event counter or as a pulse width measurement device. Timer2 can be configured as timer mode only. There are two types of registers related to the Timer/Event Counters. The first are the registers that contains the actual value of the Timer/Event Counter and into which an initial value can be preloaded, and are known as TMR0L/TMR0H, TMR1L/TMR1H and TMR2L/TMR2H. Reading these register pairs retrieves the contents of the Timer/Event Counters. The second type of associated register are the Timer Control Regis- ters, which defines the timer options and determines how the Timer/Event Counters are to be used, and have the name TMR0C, TMR1C and TMR2C, Timer0 and Timer1 can have the timer clock configured to come from the internal clock source or from an external timer pin. Timer2 can have the timer clock come from internal system clock only. Configuring the Timer/Event Counter Input Clock Source For Timer/Event Counter 0, the internal timer clock source can originate from either the system clock/4 or from an external clock source. For Timer/Event Counter 1, the internal timer clock source can originate from the 32768Hz or from an external clock source. An external clock source is used when the timer is in the event counting mode, the clock source being provided on the external timer pins TMR0 or TMR1. Depending upon the condition of the T0E or T1E bit, each high to low, or low to high transition on the external timer pin will increment the counter by one. Timer Registers - TMR0L/TMR0H, TMR1L/TMR1H, TMR2L/TMR2H The timer registers are special function register pairs lo- cated in the Special Purpose Data Memory and is the place where the 16-bit actual timer value is stored. These register pairs are known as TMR0L/TMR0H, TMR1L/TMR1H and TMR2L/TMR2H. The value in the timer register pair increases by one each time an inter- nal clock pulse is received or an external transition oc- curs on the external timer pin. The timer will count from the initial value loaded by the preload register to the full count of FFFFH at which point the timer overflows and an internal interrupt signal is generated. The timer value will then be reset with the initial preload register value and continue counting. To achieve a maximum full range count of FFFFH the preload register must first be cleared to all zeros. It should be noted that after power-on, the preload register will be in an unknown condition. Note that if the Timer/Event Counter is switched off and data is written to its preload register, this data will be immediately writ- ten into the actual timer register. However, if the Timer/Event Counter is enabled and counting, any new data written into the preload data register during this pe- riod will remain in the preload register and will only be written into the timer register the next time an overflow occurs. Reading from and writing to these registers is carried out in a specific way. It must be noted that when using in- structions to preload data into the low byte register, namely TMR0L, TMR1L or TMR2L, the data will only be placed in a low byte buffer and not directly into the low byte register. The actual transfer of the data into the low byte register is only carried out when a write to its asso- ciated high byte register, namely TMR0H, TMR1H or TMR2H, is executed. Also, using instructions to preload data into the high byte timer register will result in the data being directly written to the high byte register. At the same time the data in the low byte buffer will be transferred into its associated low byte register. For this reason, when preloading data into the 16-bit timer regis- ters, the low byte should be written first. It must also be noted that to read the contents of the low byte register, a read to the high byte register must first be executed to latch the contents of the low byte buffer from its associ- ated low byte register. After this has been done, the low byte register can be read in the normal way. Note that reading the low byte timer register directly will only result in reading the previously latched contents of the low byte buffer and not the actual contents of the low byte timer register. |
|
リンク URL |
| ALLDATASHEETはお客様のビジネスに役立ちますか? [ DONATE ] |
Alldatasheetは | 広告 | お問い合わせ | プライバシーポリシー | データシートへのリンク | リンク交換 | メーカーリスト All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |