| Electronic Components Datasheet Search |
|
HT48F06E Datasheet(PDF) 27 Page - Holtek Semiconductor Inc |
|
|
|||||||||||||||||||||||||||||
HT48F06E Datasheet(HTML) 27 Page - Holtek Semiconductor Inc |
|
27 / 74 page ![]() HT48F06E/HT48F10E/HT48F30E Rev. 1.60 27 July 29, 2009 Programming Considerations Within the user program, one of the first things to con- sider is port initialization. After a reset, all of the I/O data and port control registers will be set high. This means that all I/O pins will default to an input state, the level of which depends on the other connected circuitry and whether pull-high options have been selected. If the port control registers, PAC, PBC, PCC, etc., are then pro- grammed to setup some pins as outputs, these output pins will have an initial high output value unless the as- sociated port data registers, PA, PB, PC, etc., are first programmed. Selecting which pins are inputs and which are outputs can be achieved byte-wide by loading the correct values into the appropriate port control register or by programming individual bits in the port control reg- ister 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 re- write 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. Each device contains a single count-up timer of 8-bit capacity. As each timer has three different operating modes, they can be configured to op- erate as a general timer, an external event counter or as a pulse width measurement device. The provision of an internal prescaler to the clock circuitry gives added range to the timer. There are two types of registers related to the Timer/Event Counters. The first is the register that con- tains the actual value of the Timer/Event Counter and into which an initial value can be preloaded, and is known as TMR. Reading from this register retrieves the contents of the Timer/Event Counter. The second type of associated register is the Timer Control Register, which defines the timer options and determines how the Timer/Event Counter is to be used, and has the name TMRC. All devices can have the timer clock configured to come from the internal clock source. In addition, the timer clock source can also be configured to come from an external timer pin. An external clock source is used when the Timer/Event Counter is in the event counting mode, the clock source being provided on the external timer pin. This pin has the name TMR and is pin-shared with an I/O pin. De- pending upon the condition of the TE bit in the Timer Control Register, each high to low, or low to high transi- tion on the external timer input pin will increment the Timer/Event Counter by one. Configuring the Timer/Event Counter Input Clock Source The Timer/Event Counter's clock can originate from var- ious sources. The system clock source is used when the Timer/Event Counter is in the timer mode or in the pulse width measurement mode. The system clock is divided by a prescaler, the division ratio of which is conditioned by the Timer Control Register bits PSC2~PSC0. An external clock source is used when the Timer/Event Counter is in the event counting mode, the clock source being provided on the external timer pin, TMR. De- pending upon the condition of the TE bit, each high to low, or low to high transition on the external timer pin will increment the counter by one. T 1 T 2 T 3 T 4 T 1 T 2 T 3 T 4 W r i t e t o P o r t R e a d f r o m P o r t S y s t e m C l o c k P o r t D a t a Read/Write Timing T M R T E T i m e r / E v e n t C o u n t e r M o d e C o n t r o l T O N P r e l o a d R e g i s t e r T i m e r / E v e n t C o u n t e r D a t a B u s R e l o a d O v e r f l o w t o I n t e r r u p t B Z B Z P S C 2 ~ P S C 0 ( 1 / 2 ~ 1 / 2 5 6 ) 8 - B i t T i m e r / E v e n t C o u n t e r T M 1 T M 0 2 ¸ f S Y S 8 - S t a g e P r e s c a l e r 8-bit Timer/Event Counter Structure |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List 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 |