简体   繁体   English

MSP430兼容性问题

[英]MSP430 Problems with compatibility

I'm using an MSP430 Launchpad. 我正在使用MSP430 Launchpad。 To be more specific I'm using the microcontroler MS430G2553. 更具体地说,我正在使用微控制器MS430G2553。 I was trying to compile some code designed for the MS430G2230 but the problem is that some parts of the code wont match the MS430G2553. 我正在尝试编译为MS430G2230设计的一些代码,但问题是代码的某些部分与MS430G2553不匹配。 This is the code 这是代码

void USI_Init (void)
{
 // configure SPI
 USICTL0 |= USISWRST;                      // USI in reset
 USICTL0 = USICTL0 | USILSB;               // Least Significant Bit first
 USICTL0 |= USIPE7 + USIPE6 + USIPE5 + USIMST + USIOE; // Port, SPI Master
 USICTL1 |= USICKPH;                       // flag remains set
 USICKCTL = USIDIV_1 + USISSEL_2;          // /2 SMCLK
 USICTL0 &= ~USISWRST;                     // USI released for operation
 USICNT = USICNT | 0x50;                   // 16 bit mode; 16 bit to be    transmitted/received
 return;
}


and this is the second routine that doesn't work 这是第二个不起作用的例程


#pragma vector=WDT_VECTOR
__interrupt void Write_Matrix(void)
{
static unsigned char index=0;

 P1OUT |= DATA_LATCH_PIN;
 P1OUT &= ~DATA_LATCH_PIN;

  USICTL1 &= ~USIIFG;           // Clears the interrupt flag
  USISRH = 1<<index;            // Move the index of the column in the high bits of USISR
  USISRL = Matrix[index];       // Move the index of the rows (value of Matrix[index]) in the low bits of USIRS
  USICNT = USICNT | 0x10;       // 16 bit format
 index = (index+1) & 7;

 return;
}

Any Ideas? 有任何想法吗? Thanks 谢谢

First off, you shouldn't expect to have code that is 100% portable between those two families of processors. 首先,您不应期望在这两个处理器系列之间具有100%可移植的代码。 The MSP430G2553 is a much larger value line processor and comes with more peripherals than the MSP430G2230. MSP430G2553是一款体积更大的线路处理器,具有比MSP430G2230更多的外设。

Please refer to the following diagrams: 请参考下图:

MSP430G2230 Functional Diagram MSP430G2230功能框图

MSP430G2230功能框图

MSP430G2553 Functional Diagram MSP430G2553功能框图

MSP430G2553功能框图

As you can see, these MCUs are very different. 如您所见,这些MCU非常不同。

Your first routine doesn't work because the MSP430G2553 doesn't have a USI peripheral. 您的第一个例程不起作用,因为MSP430G2553没有USI外设。 Instead, SPI communication is performed using a USCI peripheral. 相反,使用USCI外设执行SPI通信。 You will need to modify your code to use this peripheral instead. 您需要修改代码才能使用此外围设备。 Please reference the User's Guide for more information. 有关更多信息,请参阅用户指南

Your second routine doesn't work because of the lack of USI peripheral again. 由于缺少USI外围设备,您的第二个例程不起作用。 Notice the references to USI registers: USICTL1 &= ~USIIFG; 注意USI寄存器的引用: USICTL1 &= ~USIIFG; , etc. You will need to once again modify your code to use the USCI peripheral. 等等。您需要再次修改代码以使用USCI外设。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM