日本黄色一级经典视频|伊人久久精品视频|亚洲黄色色周成人视频九九九|av免费网址黄色小短片|黄色Av无码亚洲成年人|亚洲1区2区3区无码|真人黄片免费观看|无码一级小说欧美日免费三级|日韩中文字幕91在线看|精品久久久无码中文字幕边打电话

當(dāng)前位置:首頁 > 單片機(jī) > 單片機(jī)
[導(dǎo)讀]PIR1 Register The PIR1 register contains the individual flag bits for the peripheralinterrupts.PIR1 REGISTERPSPIF ADIF RCIF TXIF SSPIF CCP1IF TMR2IF TMR1IFSSPIF:Synchronous Serial Port Interrupt Flag

PIR1 Register
The PIR1 register contains the individual flag bits for the peripheral
interrupts.

PIR1 REGISTER
PSPIF ADIF RCIF TXIF SSPIF CCP1IF TMR2IF TMR1IF

SSPIF:Synchronous Serial Port Interrupt Flag bit
1 = The SSP interrupt condition has occurred and must be cleared in software
before returning from the interrupt Service Routine. The condition that will
set this are:
SPI-A transmission/reception has taken,place.
I2C Slave - A transmission/reception has taken place.
I2C Master
0 = No SSP interrupt condition has occurred.

SSPCON1: MSSP CONTROL REGISTER1
WCOL SSPOV SSPEN CKP SSPM3 SSPM2 SSPM1 SSPM0

SMP:Sample bit

SPI Master mode:

1 = Input data sampled at end of data output time

0 = Input data sampled at middle of data output time

SPI Slave mode:

SMP must be cleared when SPI is used in Slave mode.

CKE:SPI Clock Select bit

1 = Transmit occurs on transition from active to Idle clock state

0 = Transmit occurs on transition from Idle to active clock state

BF:Buffer Full Status bit(Recevie mode only)

1 = Receive complete,SSPBUF is full

0 = Receive not complete,SSPBUF is empty

SSPSR寄存器我們是不能直接使用的。

SPI的工作方式可以從兩個方面來看,一個是數(shù)據(jù)的傳送,一個是數(shù)據(jù)的接收。送出數(shù)據(jù)的時候,只要將數(shù)據(jù)寫入SSPBUF即可;在數(shù)據(jù)傳送完成之后,SSPIF中斷標(biāo)志位會置1。接收的時間就比較復(fù)雜了。當(dāng)有數(shù)據(jù)從SDI引腳進(jìn)入單片機(jī)之后,會被存往往到SSPSR寄存器中,當(dāng)完整的8個位接收完畢之后,這個字節(jié)的數(shù)據(jù)就會自動的放到SSPBUF中,一旦SSPBUF中放入新的數(shù)據(jù),SSPCON寄存器中的BF位就會自動的設(shè)定為1,表示SSPBUF已經(jīng)填入了新的值,也表示數(shù)據(jù)的接收已完成。

由于PIC16F877A通過SDO發(fā)送數(shù)據(jù)的同時,會通過SDI讀入數(shù)據(jù),當(dāng)1字節(jié)的發(fā)送完成時,剛好接收1字節(jié)到SSPBUF,這時SSPBUF滿,BF被置1,故可通過BF標(biāo)志判斷1字節(jié)是否發(fā)送完成。


本站聲明: 本文章由作者或相關(guān)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實(shí)性等。需要轉(zhuǎn)載請聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請及時聯(lián)系本站刪除( 郵箱:macysun@21ic.com )。
換一批
延伸閱讀
關(guān)閉