| поискавой системы для электроныых деталей |
|
SX28AC/DP датащи(PDF) 11 Page - Parallax Inc |
|
|
|||||||||||||||||||||||||||||
SX28AC/DP датащи(HTML) 11 Page - Parallax Inc |
|
11 / 51 page ![]() Parallax SX20AC/SX28AC www.parallax.com © Parallax Inc. Page 11 of 51 Rev 1.6 11/20/2006 3.1.1. Read-Modify-Write Considerations Caution must be exercised when performing two successive read-modify-write instructions (SETB or CLRB operations) on an I/O port pin. Input data used for an instruction must be valid during the time the instruction is executed, and the output result from an instruction is valid only after that instruction completes its operation. Unexpected results from successive read- modify-write operations on I/O pins can occur when the device is running at high speeds. Although the device has an internal write-back section to prevent such conditions, it is still recommended that the user program include a NOP instruction as a buffer between successive read- modify-write instructions performed on I/O pins of the same port. Also note that reading an I/O port is actually reading the pins, not the output data latches. That is, if the pin output driver is enabled and driven high while the pin is held low externally, the port pin will read low. 3.2. Port Configuration Each port pin offers the following configuration options: • data direction • input voltage levels (TTL or CMOS) • pullup type (pullup resistor enable or disable) • Schmitt trigger input (for Port B and Port C only) Port B offers the additional option to use the port pins for the Multi-Input Wakeup/Interrupt function and/or the analog comparator function. Port configuration is performed by writing to a set of control registers associated with the port. A special- purpose instruction is used to write these control registers: • mov !RA,W (move W to Port A control register) • mov !RB,W (move W to Port B control register) • mov !RC,W (move W to Port C control register) Each one of these instructions writes a port control register for Port A, Port B, or Port C. There are multiple control registers for each port. To specify which one you want to access, you use another register called the MODE register. 3.2.1. MODE Register The MODE register controls access to the port configuration registers. Because the MODE register is not memory-mapped, it is accessed by the following special purpose instructions: • mov M, #lit (move literal to MODE register) • mov M,W (move W to MODE register) • mov W,M (move MODE register to W) The value contained in the MODE register determines which port control register is accessed by the “mov !rx,W” instruction as indicated in Table 2-1. MODE register values not listed in the table are reserved for future expansion and should not be used. Therefore, the MODE register should always contain a value from 08h to 0Fh. Upon reset, the MODE register is initialized to 0Fh, which enables access to the port direction registers. After a value is written to the MODE register, that setting remains in effect until it is changed by writing to the MODE register again. For example, you can write the value 0Eh to the MODE register just once, and then write to each of the three pullup configuration registers using the three “mov !rx,W” instructions. Table 3-2: MODE Register and Port Control Register Access MODE Reg. Mov !RA,W Mov !RB, W Mov !Rc, W 08h not used CMP_B not used 09h not used WKPND_B not used 0Ah not used WKED_b not used 0Bh not used WKEN_B not used 0Ch not used ST_B ST_C 0Dh LVL_A LVL_B LVL_C 0Eh PLP_A PLP_B PLP_C 0Fh RA Direction RB Direction RC Direction The following code example shows how to program the pullup control registers. mov M,#$0E ;MODE=0Eh to access port pullup ;registers mov W,#$03 ;W = 0000 0011 mov !RA,W ;disable pullups for RA0 and RA1 mov W,#$FF ;W = 1111 1111 mov !RB,W ;disable all pullups for RB0-RB7 mov W,#$00 ;W = 0000 0000 mov !RC,W ;enable all pullups for RC0-RC7 First the MODE register is loaded with 0Eh to select access to the pullup control registers (PLP_A, PLP_B, and PLP_C). Then the “mov !rx,W” instructions are used to specify which port pins are to be connected to the internal pullup resistors. Setting a bit to 1 disconnects the corresponding pullup resistor, and clearing a bit to 0 connects the corresponding pullup resistor. 3.2.2. Port Configuration Registers The port configuration registers that you control with the “mov !rx,W” instruction operate as described below. RA, RB, and RC Data Direction Registers (MODE=0Fh) Each register bit sets the data direction for one port pin. Set the bit to 1 to make the pin operate as a high- impedance input. Clear the bit to 0 to make the pin operate as an output. |
|
ссылки URL |
| Вашему бизинису помогли Аллдатащит? [ DONATE ] |
Что такое Аллдатащит | реклама | контакт | Конфиденциальность | Ссылка на техническое описание | обмен ссыками | поиск по производителю 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 |