| 数据搜索系统,热门电子元器件搜索 |
|
AN975 数据表(PDF) 7 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN975 数据表(HTML) 7 Page - STMicroelectronics |
|
7 / 11 page ![]() 7/11 UPGRADING FROM ST625X/6XB TO ST625X/6XC 1.2.4 SPI When the SPI is used in master mode, the SCK pin (PC4) and Sout pin (PC3) work in output mode and the Sin pin (PC2) in input mode. On ST625X/6XC, the Port C pins used for the SPI have to be configured in input mode either with or without pull-up. Their reset configuration doesn’t have to be changed. To enable the SPI in master mode, the SPCLK bit in the SPI mode control register has to be set. By setting this bit, the SCK pin (PC4) is automatically configured in output push-pull mode and the clock is output at the frequency configured in the SPIDIV register. The output of the SPI data register Sout pin (PC3) is also automatically configured in output push-pull by setting bit 0 in the MISCR register. The following is a software example of how to use the SPI in master mode: .org 080h (or CSEG AT 080H depending on the toolchain) reset: clr X clr A reti ; Exit NMI mode ldi WDGR, watchtim ; Load the watchdog ldi OSCR, 00h ; Set the oscillator ratio to 1 ldi DDRC, 00h ; Port C in reset state ldi ORC, 00h ldi DRC, 00h ldi MISCR, 001h ; Enable Sout ; (PC3 is configured in output push-pull) ldi SPIDIV, 048h ; Clock ratio = 1 / 9 bits frame ldi SPIMOD, 03Eh ; CPOL = 0 / Filters enabled / SPCLK = 1 / CPHA = 1 ; SPSTRT = 1 / SPIN = 1 / SPIE = 0 ; (PC4 is configured as output push-pull) ldi SPIDR, 0AAh ; Load the data to be send set 7, SPIMOD ; Enable the transmission (SPIRUN = 1) loop: jrs 7, SPIMOD, loop ; Poll the bit SPIRUN for end of transmission ..... |
|
|
链接网址 |
| 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 |