亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? dupuart.doc

?? Duplex UART Routines for the 8xC751 and 8xC752 Microcontrollers
?? DOC
字號:

A Software Duplex UART for the 751/752                                  AN446

The following program contains routines that will allow an 8xC751 or 8xC752 to 
implement a software UART that can send and receive serial data 
simultaneously. Other published software UARTs only allow either transmit or 
receive to occur at any one time. The demo application shown in the code 
listing waits for data to be received, then echoes it and follows this with a 
hexadecimal interpretation of the data plus a space. For instance, if the 
program receives the character "$", it echoes back the string "$24".  The 
reason for echoing these additional characters is to make it easy to force the 
receiver buffer to fill up in order to test the handshaking. If the program 
simply echoed what was received, it would likely never use more than the very 
first receiver buffer location since it can normally transmit just as fast as 
it can receive. 


CHIP RESOURCES

The UART routines use about 400 bytes of code space and use the timer to 
provide a constant time interrupt to synchronize both transmit and receive 
operations. The hardware connections require four device pins to accomplish 
serial I/O with RTS/CTS handshaking. Only two pins would be needed if 
handshaking is not required. Three of the four pin functions may be assigned 
to any port pin. The serial input pin must be assigned as one of the external 
interrupt pins. Another two pins are used in the demo application to input a 
selection of one of four baud rates (1200, 2400, 4800, or 9600). 


LIMITATIONS

To obtain duplex operation, a fairly large portion of the chip's time is used. 
The routines were tested up to 9600 baud running on a 16 MHz 87C751. When 
serial input and output were both occurring at the same time, the routines 
could not support continuous operation with no pauses between characters. At 
4800 baud, full speed tight reception and transmission worked flawlessly. In 
other words, 4800 baud should work with all applications, while 9600 baud may 
not work with all applications. 


THEORY OF OPERATION

There are three possible sequences of events when serial transmit and receive 
may both be operating at once: transmit and receive begin simultaneously; 
transmit is requested while the receiver is busy; and receive starts while the 
transmitter is busy. The first 2 cases could be handled fairly simply with 
only one interrupt for each bit time. In the first case, everything is already 
in synch and only one timer and one interrupt per bit is needed to do both 
operations. In the second case (transmit is requested while the receiver is 
busy) the program could just wait for the next bit time to start transmitting. 
Unfortunately, the third case presents a problem. If the program is already 
transmitting, it cannot always wait for the next bit time to start sampling 
the serial data if the application is not to lose bits. Also, the timer cannot 
be adjusted to the incoming data since this would distort the duration of one 
of the transmitted bits. 

The method used here to deal with this problem is to always divide all bit 
times into 4 sub-bit times. When transmission and/or reception is in progress, 
the timer runs at 4X the bit rate for the selected baud rate. The variables 
TxTime and RxTime are used to count sub-bit times for the transmitter and the 
receiver, respectively. Both are initialized to a negative value and count up 
to simplify testing for an active sub-bit time. The maximum baud rate that can 
be supported is essentially determined by the maximum amount of time that it 
might take the microcontroller to do all of the operations associated with 
transmitting one bit and receiving one bit . This must be done within the time 
between timer interrupts. 

When both transmit and receive operations are scheduled for the same timer 
interrupt, priority is given to the transmitter routine. The reason for this 
is that a great deal of jitter can be tolerated in the timing of the received 
bit sampling, but the transmitted data must "look" good to the outside world. 

The actual bit times for transmit and receive are counted by the variables 
TxCnt and RxCnt, respectively. When an active sub-bit time slice occurs, these 
variables tell the transmit and receive routines what to do in the current 
time slice. The value 11 hex indicates a start bit, 10 hex indicates a stop 
bit, and the values 8 through F hex indicate a data bit. The values were 
chosen to allow quick determination of the appropriate action by the code. 

The routines provide for a small amount of data buffering for both the 
transmitter and the receiver. As implemented here, the transmitter buffer is 
only one byte deep, allowing one data byte to be held while another is being 
transmitted. The receiver buffer is larger, allowing three bytes to be held 
while a fourth is being received. If the receiver buffer fills up (indicated 
by the flag RxFull), the application code must retrieve one byte before a 
fourth one finishes, or data will be lost. If this happens, a flag will be set 
(OverrunErr) to indicate that the receiver buffer has been overrun. There is 
no similar flag for the transmitter, since the transmit request routine waits 
for the transmitter buffer to be available (indicated by the TxFull flag) 
before taking action. It is up to the application code to check this flag in 
advance if it does not want to stall execution while waiting to transmit data. 

As each routine finishes a whole data byte by completing the send or receive 
of a stop bit, it checks to see if there is something still happening to 
warrant having the time slice interrupt running. In the case of a received 
stop, the transmit activity flag (TxOn) is examined. If it is not set, the 
timer is turned off. The timer will be turned back on if an interrupt from a 
serial start bit is received or the main code requests data to be transmitted. 
In the case of a transmitted stop, both the receiver activity flag (RxOn) and 
the transmit buffer flag (TxFull) are examined. If the receiver is active or 
there is more data to transmit, leave the timer is left running. 

All of the status flags are in the "Flags" register. Other status flags found 
there are: RxAvail, which indicates that the receiver buffer contains 
unprocessed data; and FramingErr which is set when the receiver routines find 
an improper start or stop bit, usually caused by mismatched baud rates. 

Flow control handshaking is provided by the RTS/CTS scheme. The transmit 
routine looks at the incoming CTS line before beginning each start bit 
transmission, and simply exits, waiting for the next time slice, if CTS is not 
asserted. The receive routine checks the buffer status whenever a start bit 
interrupt occurs and de-asserts the outgoing RTS line if the buffer already 
contains two bytes (i.e., it will be full when the current byte finishes). If 
the device at the other end of the communication line follows the same rules 
(which may very well NOT be the case) the program should be able to 
communicate without buffer overflows in either direction. 

Baud rates in both the send and receive routines are determined by two things: 
the timer interrupt rate; and the number of time slices per bit. The method of 
calculating the timer value for various baud rates is discussed in the code 
listing at the BaudRate routine. This discussion has centered on there being 
four time slices per bit, but if the user wants, set either the transmitter or 
the receiver can be set to run at a baud rate that is a multiple of the other 
by adjusting the value of the constant TxBitLen or RxBitLen. The baud rate 
would be calculated as indicated for the faster channel, and TxBitLen or 
RxBitLen would be changed for the slower channel. For example, the transmitter 
can be set to run at half of the receiver baud rate by setting TxBitLen to -8 
+ 1. 

The routines shown also make provision for changing the baud rate "on the 
fly", although the application code given does not implement this feature. If 
the application code changes the baud rate for some reason, the change will be 
effected when the next data transmission or reception begins, if both the 
transmitter and receiver were already idle. This prevents the timer value from 
being changed in the middle of a data byte. 


THE CODE

There are a number routines in the code that the user should be aware of:

  Intr0     - Called (by interrupt) when a serial start bit is  received.
  Timer0    - Called (by interrupt) for every sub-bit time slice.
  RS232TX   - Called by Timer0 when the transmitter has business to conduct in 
                the current time slice.
  RS232RX   - Called by Timer0 when the receiver has business to conduct in 
                the current time slice.
  BaudRate  - Sets the baud rate variables BaudHigh and BaudLow based on the 
                accumulator value.
  TxSend    - Called by the application code to request that a data byte be 
                transmitted. The data to be transmitted is in the accumulator. 
  GetRx     - Called by the application code to request return of a received 
                data byte from the buffer. Data is returned in the 
                accumulator. This routine should not be called unless the 
                receiver buffer has data available. 
  Reset     - Start of the initialization code to set up the UART.
  MainLoop  - Start of the mainline code of the demo application.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一二三四在线| 3d成人动漫网站| 久久99精品视频| 美女脱光内衣内裤视频久久网站 | 亚洲精品国产一区二区精华液| 精品国产污污免费网站入口| 日韩女优av电影在线观看| 欧美成va人片在线观看| 精品久久久久久最新网址| 精品粉嫩aⅴ一区二区三区四区| 亚洲精品一区二区在线观看| 久久久综合网站| 亚洲国产精品成人综合| 日韩美女视频一区二区 | 国产精品中文欧美| 高清成人免费视频| 日本乱人伦aⅴ精品| 欧美优质美女网站| 欧美一级二级三级乱码| 精品伦理精品一区| 国产精品视频一二| 婷婷开心久久网| 久久狠狠亚洲综合| 91免费视频网| 欧美一区二区三区日韩视频| 国产色产综合产在线视频| 玉足女爽爽91| 激情成人综合网| 在线中文字幕一区| 91麻豆精品国产自产在线观看一区 | 国产精品一区二区91| 97久久超碰国产精品| 精品久久人人做人人爰| 国产一区不卡视频| 色综合久久88色综合天天| 69精品人人人人| 欧美激情一区在线观看| 亚洲成人免费av| 精品捆绑美女sm三区| 国产精品1区二区.| 亚洲h精品动漫在线观看| 蜜桃久久久久久久| 在线亚洲一区观看| 久久精品夜色噜噜亚洲a∨| 亚洲成人一区二区在线观看| 国产成人午夜电影网| 4438成人网| 亚洲高清在线精品| 97精品久久久久中文字幕| 久久这里只有精品视频网| 婷婷成人激情在线网| 在线观看日韩av先锋影音电影院| 久久久久久免费| 奇米888四色在线精品| 欧美中文字幕久久| 亚洲日本电影在线| 成人午夜在线视频| 久久亚洲春色中文字幕久久久| 性感美女久久精品| 国产精品视频一二三区 | 欧美精品一区二区三区在线| 国产成人自拍网| 天堂av在线一区| 色综合网站在线| 国产精品久久久久久久裸模| 久久激情综合网| 欧美一区二区三区性视频| 亚洲国产精品尤物yw在线观看| 色婷婷国产精品久久包臀| 综合电影一区二区三区 | 欧美成人a∨高清免费观看| 午夜精品久久久久久久99樱桃| 色婷婷av一区二区三区大白胸| 亚洲国产精品传媒在线观看| 国产成人8x视频一区二区| 久久精品视频免费| 国产91丝袜在线18| 国产精品的网站| 色综合久久88色综合天天免费| 国产精品久久免费看| 不卡av在线网| 最新久久zyz资源站| 91丨国产丨九色丨pron| 亚洲日本va在线观看| 日本精品裸体写真集在线观看| 亚洲一区在线视频| 制服丝袜av成人在线看| 国产一区二区免费看| 亚洲欧洲性图库| 欧美伊人久久大香线蕉综合69| 亚洲国产欧美日韩另类综合| 欧美一区二区精品在线| 国产专区欧美精品| 亚洲男人的天堂在线aⅴ视频| 欧美色图第一页| 国产一区二区三区四区在线观看| 国产人久久人人人人爽| 色欧美日韩亚洲| 麻豆精品新av中文字幕| 国产精品福利影院| 欧美日韩高清一区二区| 国产老妇另类xxxxx| 亚洲私人黄色宅男| 91精品综合久久久久久| 福利一区福利二区| 香蕉影视欧美成人| 欧美国产成人精品| 欧美日韩国产综合视频在线观看| 国产在线精品一区二区不卡了 | 欧美欧美欧美欧美首页| 久久99精品国产麻豆婷婷洗澡| 国产精品网曝门| 91.麻豆视频| av亚洲产国偷v产偷v自拍| 午夜一区二区三区在线观看| 久久尤物电影视频在线观看| 91片黄在线观看| 精品一区二区三区欧美| 亚洲丶国产丶欧美一区二区三区| 久久午夜羞羞影院免费观看| 欧美日韩在线观看一区二区| 国产999精品久久| 捆绑调教一区二区三区| 亚洲国产aⅴ天堂久久| 国产精品全国免费观看高清| 日韩欧美二区三区| 久久免费的精品国产v∧| 91福利资源站| av电影天堂一区二区在线| 激情综合色综合久久综合| 亚洲一二三区在线观看| 国产精品卡一卡二| 久久综合九色综合欧美亚洲| 欧美一区二区三区啪啪| 欧美色中文字幕| 在线观看免费视频综合| 99久久精品费精品国产一区二区| 国产一区二区三区最好精华液| 婷婷激情综合网| 首页亚洲欧美制服丝腿| 亚洲综合一区二区| 亚洲视频在线一区| 国产精品伦理在线| 国产精品久久午夜夜伦鲁鲁| 中文欧美字幕免费| 欧美国产视频在线| 国产精品女人毛片| 国产精品欧美综合在线| 国产视频一区二区在线观看| 精品国产乱码久久久久久闺蜜| 日韩欧美的一区二区| 日韩精品自拍偷拍| 欧美刺激午夜性久久久久久久| 欧美一区二区精品在线| 日韩一本二本av| 日韩精品一区二区三区swag | 色婷婷av一区| av电影在线观看完整版一区二区| 岛国精品一区二区| 91尤物视频在线观看| 日本黄色一区二区| 欧美男人的天堂一二区| 日韩欧美在线观看一区二区三区| 日韩欧美视频一区| 国产欧美日韩精品在线| 自拍av一区二区三区| 亚洲午夜免费电影| 美国毛片一区二区| 成人午夜视频福利| 欧美体内she精高潮| 日韩欧美在线观看一区二区三区| 久久夜色精品一区| 中文字幕字幕中文在线中不卡视频| 亚洲精品乱码久久久久久黑人| 日韩主播视频在线| 国产精品中文字幕日韩精品 | 亚洲va天堂va国产va久| 日韩av电影免费观看高清完整版在线观看| 婷婷久久综合九色综合伊人色| 狠狠v欧美v日韩v亚洲ⅴ| 99国产精品视频免费观看| 欧美疯狂做受xxxx富婆| 久久亚洲精品国产精品紫薇| 亚洲精品免费播放| 国产中文字幕精品| 欧美日韩一卡二卡三卡| 久久久久99精品一区| 亚洲成人免费观看| 成人精品免费看| 日韩欧美精品在线| 亚洲欧美一区二区三区国产精品| 日韩高清在线不卡| 成人av电影在线播放| 日韩三级在线观看| 亚洲人成在线观看一区二区| 久久99久久99精品免视看婷婷| 91看片淫黄大片一级在线观看| 欧美精品一区二区三区很污很色的 | 51午夜精品国产| 亚洲欧洲韩国日本视频|