Electronic Components Datasheet Search |
|
AN432 Datasheet(PDF) 7 Page - STMicroelectronics |
|
AN432 Datasheet(HTML) 7 Page - STMicroelectronics |
7 / 12 page 7/12 USING ST62xx I/O PORTS SAFELY 3 OPERATION OF SINGLE BIT INSTRUCTIONS The ST62XX instruction set includes four different instructions operating on single bits. The first two instructions use a read-modify-write cycle. – SET Set Bit in Register – RES Reset Bit in Register – JRS Jump Relative IF Bit in Register is set – JRR Jump Relative IF Bit in Register is reset The single bit instructions read a whole byte (8 bits), perform an “AND” (RES, JRR) or “OR” (SET, JRS) operation with a single bit mask operand (e.g 01h for bit 0, 04h for bit 2), and, in the case of SET and RES, write the result back to the source. Thus the whole byte is processed, even if only one bit is modified or tested. This causes some constraints in using these instructions with the Data Register. Table 2. Example for the operation of a single bit instruction Restrictions in using SET and RES instructions As an example, let us assume that one or more of the pins of the port are set to input mode. A SET/RES operation on a bit of DR will read the state of the corresponding input pin instead of the content of DR. After modifying the specified bit, the result will be written (as a byte) back into DR. Depending on the state of the specified inputs, the contents of DR may be changed. This can cause a change of the input mode by accident, that is, depending on the state of the corre- sponding bit in OR, the pin operation mode can be switched from input mode with pull-up to input mode without pull-up (or vice-versa) or from interrupt mode to analog input (or vice- versa). These side effects on the I/O port may be avoided if a copy of the DR content is kept in a RAM location. Now SET/RES instructions can be executed on the RAM location, and the result then written to DR as shown in Table 3. RAM (Before) RAM (After) Address Data Address Data SET 3,085h 085h 055h 055h 01010101 B 085h 05Ch OR 008h 00001000 B 05Ch 01011101 B |
Similar Part No. - AN432 |
|
Similar Description - AN432 |
|
|
Link URL |
Privacy Policy |
ALLDATASHEET.NET |
Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | 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 |