//******************************************************************************
// MSP430x24x Demo - USCI_A0, SPI Interface to HC164 Shift Register
//
// Description: This program demonstrates USCI_A0 in SPI mode, interfaced to
// a 'HC164 shift register' (Serial In, Parallel Out), transferring the value
// contained in Data.The value is incremented in the mainloop, effectively
// incrementing HC164 QA - QH.
// ACLK = n/a, MCLK = SMCLK = default DCO ~1.045Mhz, BRCLK = SMCLK/2
//
// MSP430F249
// -----------------
// /|\| XIN|-
// | | | ^ HC164
// --|RST XOUT|- | -------------
// | | |-|/CLR,B | 8
// | UCA0SIMO/P3.4|--------->|A Qx|--\->
// | UCA0CLK/P3.0|--------->|CLK |
// | | | |
//
// B. Nisarga
// Texas Instruments Inc.
// September 2007
// Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.42A
//******************************************************************************
#include "msp430x24x.h"
unsigned char Data;
volatile unsigned int i,j;
unsigned char seg_seven[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
unsigned char shaomiao_wei[]={0x01,0x02,0x04,0x08};
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P3SEL |= 0x11; // P3.0,4 USCI_A0 option select
UCA0CTL0 |= UCCKPH + UCMSB + UCMST + UCSYNC; // 3-pin, 8-bit SPI master
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 |= 0x02;
UCA0BR1 = 0;
UCA0MCTL = 0;
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
P1DIR=BIT0;
Data = 0x0FF; // Load inital data
while(1)
{
Data++; // Increment Data value - Set BREAKPOINT here
while (!(IFG2 & UCA0TXIFG)); // USCI_A0 TX buffer ready?
UCA0TXBUF = seg_seven[3]; // Byte to SPI TXBUF
P1OUT=BIT0;
for(i = 0xfff; i > 0; i--); // Delay
j++;
if(j==10)
j=0;
P1OUT=~BIT0;
for(i = 0xfff; i > 0; i--); // Delay
}
}
SPI.rar_430 spi_SPI验证
版权申诉
195 浏览量
2022-09-23
09:42:17
上传
评论
收藏 18KB RAR 举报
钱亚锋
- 粉丝: 88
- 资源: 1万+
最新资源
- 1961ee27df03bd4595d28e24b00dde4e_744c805f7e4fb4d40fa3f695bfbab035_8(1).c
- mediapipe-0.9.0.1-cp37-cp37m-win-amd64.whl.zip
- windows注册表编辑工具
- mediapipe-0.9.0.1-cp37-cp37m-win-amd64.whl.zip
- 校园通行码预约管理系统20240522075502
- 车类型数据集6250张VOC+YOLO格式.zip
- The PyTorch implementation of STGCN.STGCN-main.zip
- 092300108.cpp
- 车类型数据集6000张VOC+YOLO格式.zip
- for daily read
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈