This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CCS/MSP430F2616:MSP430f2616速度变化

Guru**** 1832870 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/608121/ccs-msp430f2616-msp430f2616-speed-change

器件型号:MSP430F2616

工具/软件:Code Composer Studio

当我将用于循环乘法器的用作80000时、此代码用于提供延迟为1秒的 LCD 递增计数。 现在、我已经将其减少到80、但它仍提供相同的延迟量。 没有针对时钟更改代码。

延迟环路为80时、它应提供10us 的延迟、但现在提供了1秒的延迟。 速度变化的可能性有多大。

#include 
#define DR P5OUT = P5OUT | BIT7 //定义 RS 高
电平#define CWR P5OUT = P5OUT &(~BIT7)//定义 RS 低
电平#define Read P5OUT = P5OUT | BIT5 //定义读取信号 R/W = 1以
读取#define WRITE P5OUT = P5W &(~BIT5)/定义写入信号 = 0用于写入
#define ENABLE_HIGH P5OUT = P5OUT | BIT6 //定义使能高电平信号
#define ENABLE_LOW P5OUT = P5OUT &(~BIT6)//定义使能低电平信号
void CHECK_BUSY (void);
void DATA_read (void);
void delay (unsigned int int int wt);
void init (wr


) lcd (void lcd);void lcd (void lcdwr);void lcd (void lcd)
void lcd_msg (unsigned char *ch);
unsigned int a、b、c、d、e、f;
//PIN R/W =
/*
main.c
*/

unsigned char array[10]={"0123456789"};

int main (void){

unsigned unsigned DTint i;
WDTCTL = WDTPW | WDTHOLD;// unsigned char array (/wr (/wr





)





(0x80+);/wr (xwr)(xw_lcd)(xw_w_wr)(xw_w_w_wr)(xwr)(xw_wr)(1);wr (wr (w_wr)(wr)(wr)(w_wr)(wr (wr)(



for (b=0;b<10;b++)
{
wm_LCD_CW (0xC1);
w_LCD_dw (array[b]);
for (c=0;c<10;c++)
{
w_LCD_CW (0xC2);
WR_LCD_dw (array[c]);
for (d=0;d<10;d++)
{
w_LCD_CW (0xc3);
w_LCD_dw (array[d]);
P1OUT ^= BIT5|BIT6|BIT7;//使用异或
延迟(1200)切换 P1.0;
}

}




}}




















void delay (unsigned int wt){unsigned int k;volatile unsigned int i;for (k=0;k <= wt

;i <= 80;i++);}void lcd_msg (unsigned char *ch){while (*ch!='0'){wr_lcd_dw (= 80;i+cw);}void lcd_ch_cw (unsigned ch_ch_ch_ch_cw);}
CWR;
写入;
ENABLE_HIGH;//EN=1
延迟(3);
ENABLE_LOW;//EN=0
}

void wr_lcd_dw (unsigned char lcd_data){
// check_busy ();
P4OUT=lcd_data;
DR;
写入;
enable_high;//en=1
delay (3);
ENABLE_LOW;//EN=0
}

void init_LCD (void)
{
wR_LCD_CW (0x38);delay (10);// 8位模式中的 LCD
wr_LCD_CW (0x0E);delay (10);delay (10);// LCD
in 8 bit INIT_LCD_CW (0x02




);// TCLB =




0x20 (void);// TCLB = 0x0 (tCLB = 0x0);// TCLB = 0x0 (t1);t1 (t1)= 0xtCL1 (t1);t1 (t1)= 0xt1 (t1);t1)




P5SEL=0;
P4SEL=0;

P1DIR=0xff;
P4DIR=0xff;
P5DIR=0xff;

P1DIR |= BIT5|BIT6;//将 P4位5和6设置为输出方向
P4DIR = 0xFF;//将端口4设置为输出
P5DIR = 0xFF;//将端口5设置为输出
P4OUT = 0x00;
P5OUT = 0x00;
}
void CHECK_BUSY (void)
{
P4DIR &=~(BIDIR);//将 P4DIR 设置为输出 P2.3_
(BIT_READ);//将 PDIO 用作输入数据(void);//将 P2.3/PUT)
while (((P4IN & BIT7)=1)
{
DATA_READ();
}
P4DIR |= BIT7;//将 P2.3作为输出
}

void data_read (void)
{
CWR;
读取;
enable_low;
延迟(2);
enable_high;
} 

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您是否有一些显示此问题的示波器屏幕截图? 为什么不只使用__delay_cycles()? 编译器是否会优化嵌套 while 循环、因为它们不执行任何操作? 您可能需要在内部放置一个__no_operation()以进行检查。 此外、80000大于允许的最大整数值(65536)。

    此致、
    Ryan
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢 Ryan、

    使用_delay_cycles 可以解决该问题。