| 数据搜索系统,热门电子元器件搜索 |
|
STC89LE52RC 数据表(PDF) 121 Page - STCmicro Technology Co,.Ltd |
|
|
|||||||||||||||||||||||||||||
STC89LE52RC 数据表(HTML) 121 Page - STCmicro Technology Co,.Ltd |
|
121 / 165 page ![]() In the above example the differentiation among the 3 slaves is in the lower 3 address bits.Slave 0 requires that bit0 = 0 and it can be uniquely addressed by 11100110. Slave 1 requires that bit 1=0 and it can be uniquely addressed by 11100101. Slave 2 requires that bit 2=0 and its unique address is 11100011. To select Salve 0 and 1 and exclude Slave 2, use address 11100100, since it is necessary to make bit2=1 to exclude Slave 2. The Broadcast Address for each slave is created by taking the logic OR of SADDR and SADEN. Zeros in this result are trended as don’t cares. In most cares, interpreting the don’t cares as ones, the broadcast address will be FF hexadecimal. Upon reset SADDR and SADEN are loaded with “0”s. This produces a given address of all “don’t cares as well as a Broadcast address of all “don’t cares”. This effectively disables the Automatic Addressing mode and allows the microcontroller to use standard 80C51-type UART drivers which do not make use of this feature. Example: write an program that continually transmits characters from a transmit buffer. If incoming characters are detected on the serial port, store them in the receive buffer starting at internal RAM location 50H. Assume that the STC89xx MCU serial port has already been initialized in mode 1. Solution: ORG 0030H MOV R0, #30H ;pointer for tx buffer MOV R1, #50H ;pointer for rx buffer LOOP: JB RI, RECEIVE ;character received? ;yes: process it JB TI, TX ;previous character transmitted ? ;yes: process it SJMP LOOP ;no: continue checking TX: MOV A, @R0 ;get character from tx buffer MOV C, P ;put parity bit in C CLR C ;change to odd parity MOV ACC.7, C ;add to character code CLR TI ;clear transmit flag MOV SBUF, A ;send character CLR ACC.7 ;strip off parity bit INC R0 ;point to next character in buffer CJNE R0, #50H, LOOP ;end of buffer? ;no: continue MOV R0, #30H ;yes: recycle SJMP LOOP ;continue checking RX: CLR RI ;clear receive flag MOV A, SBUF ;read character into A MOV C, P ;for odd parity in A, P should be set CPL C ;complementing correctly indicates "error" CLR ACC.7 ;strip off parity MOV @R1, A ;store received character in buffer INC R1 ;point to next location in buffer SJMP LOOP ;continue checking END 121 |
|
链接网址 |
| 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 |