数据搜索系统,热门电子元器件搜索
  Chinese  ▼
ALLDATASHEETCN.COM

X  

AN1445 数据表(PDF) 5 Page - STMicroelectronics

部件名 AN1445
功能描述  USING THE ST7 SPI TO EMULATE A 16-BIT SLAVE
PDF  7 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
制造商  STMICROELECTRONICS [STMicroelectronics]
网页  http://www.st.com
标志 STMICROELECTRONICS - STMicroelectronics

AN1445 数据表(HTML) 5 Page - STMicroelectronics

  AN1445 Datasheet HTML 1Page - STMicroelectronics AN1445 Datasheet HTML 2Page - STMicroelectronics AN1445 Datasheet HTML 3Page - STMicroelectronics AN1445 Datasheet HTML 4Page - STMicroelectronics AN1445 Datasheet HTML 5Page - STMicroelectronics AN1445 Datasheet HTML 6Page - STMicroelectronics AN1445 Datasheet HTML 7Page - STMicroelectronics  
Zoom Inzoom in Zoom Outzoom out
 5 / 7 page
background image
5/7
USING THE ST7 SPI TO EMULATE A 16-BIT SLAVE
In the case of concurrent interrupts, the SPI interrupt must always be the first served. The only
way to ensure this happens is to have only the SPI interrupt enabled. Otherwise, if another in-
terrupt is served between two received words, an overrun condition will occur.
In the case of nested interrupts, the SPI interrupt only needs to have the highest priority, to be
always immediately served.
CONCLUSION: The maximum baud rate, which can be reached is 2 MBaud.
4 MEASUREMENTS
The goal of the measurement is to verify the above theory and to see whether the software
correctly receives both bytes. What is especially important is the time needed to read the data
register, which releases the shift register for the reception of the 2nd byte. To measure this
time an I/O port pin is used and cleared after reading the data register. The interrupt routine is
therefore slightly modified for the measurement (Figure 6.). The timing conditions are: SPI
baud rate = 2 Mbaud and fCPU = 8 MHz.
Figure 6. Measurement Software
The time to be measured is the time taken by the “LD a,SPIDR” instruction (Ax in Figure 7.).
The point we can measure is the transition when the port pin goes low (Bx in Figure 7.). The
time between both is the time needed by “ld _SPI_Interrupt$L-1,a“and “clr PBDR”, which is
4cy+5cy=1,125us. So to Ax is 1,125us before Bx.
The measurement shows that Ax is always before the deadline. This proves that the 8-bit SPI
can be used to receive 16-bit SPI messages at speeds up to 2MBaud.
_SPI_Interrupt:
btjf _SPISR,#7,L522
ld a,_SPIDR
ld _SPI_Interrupt$L-1,a
clr _PBDR
L332:
btjf _SPISR,#7,L332
ld a,_SPIDR
ld _SPI_Interrupt$L-2,a
ld a,#255
ld _PBDR,a
iret
L522:
ld a,#196
ld_SPICR,a
iret
if (ValBit(SPISR,SPIF))
{
twobytesDR.b_form.low=SPIDR;
PBDR=0x00;
while(!ValBit(SPISR,SPIF));
twobytesDR.b_form.high=SPIDR;
PBDR=0xFF;
}
else
{
SPICR=0xC4;
}
C code
Assembly code



Html Pages

1 2 3 4 5 6 7


数据表 下载

Go To PDF Page


链接网址



ALLDATASHEET是否为您带来帮助?  [ DONATE ] 

关于 Alldatasheet   |   广告服务   |   联系我们   |   隐私政策   |   数据表链接    |   链接交换   |   制造商名单
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
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