| 전자부품 데이터시트 검색엔진 |
|
HT85F2270 데이터시트(PDF) 126 Page - Holtek Semiconductor Inc |
|
|
|||||||||||||||||||||||||||||
HT85F2270 데이터시트(HTML) 126 Page - Holtek Semiconductor Inc |
|
126 / 226 page ![]() Rev. 1.00 1�6 of ��6 �a� 1�� �01� Standard 8051 8-Bit Flash MCU HT85F2260/HT85F2270/HT85F2280 Programming Considerations Within the user program, one of the first things to consider is port initialisation. After a reset, the I/O data register will be set high and I/O port mode registers will be cleared to low. This means that all I/O pins will default to a Quasi-bidirectional structure. The I/O pins can be re-assigned to some other mode for each I/O using the control registers, PnM0 and PnM1. Ports P0~P3 provide four I/O structure modes option while the P4 and P5 only provide a Quasi-bidirectional I/O structure mode. Care should be taken to setup the correct I/O structure for each I/O pin, otherwise unexpected data will be input or output on the I/O pins. The data registers, P0~P5, reflect the value of the corresponding I/O port, however, they do not necessarily reflect the I/O pin logic state. During reading and writing of data to these registers, what actually happens is dependent upon whether the corresponding pin is setup as an output or input. A write operation is only effective when the corresponding pin is setup as an output. In such cases a write operation will setup the logic level, low or high, on the pin. A read operation will read the current logic level, low or high, on the corresponding pin. If any pins are setup to be used as A/D input pins then it is important to ensure that the I/O Port Mode registers setup the pins as inputs, which are essentially high impedance inputs. In this way the I/O logic circuits will have a minimal influence on the A/D input impedance. 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, such as using CLR or SET bit write instructions. Care should be taken that some instructions, the Read-Modify-Write instructions, operate on the Pn register, such as “INC P0” or “ANL P2, A”, while others can operate directly onto the external port input, such as “MOV A, P1”. Note that P4 and P5 cannot be modified by bit manipulation instructions as their registers are not located in bit addressable space. In case of reading, the state of P4 and P5 registers reflects the value of the corresponding I/O port. The accompanying table illustrates the Read-Modify-Write related instructions. Mnemonic Instruction Example Bit Manipulation ANL Logical AND ANL P�� A — ORL Logical OR OR P�� A — XRL Logical XOR XRL P�� A — JBC Jump if bit set and then clear bit JBC P�.0� (LABEL) — CPL Complement bit CPL P�.0 — INC Increment INC P� — DEC Decrement DEC P� — DJNZ Decrement and jump if not zero DJNZ P�� (LABEL) — �OV Px.�� C Move carry flag to Bit y of Port x �OV P�.0� C V CLR Px.� Clear Bit � of Port x CLR P�.0 V SET Px.� Set Bit � of Port x SET P�.0 V |
|
링크 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 |