搜索
bottom↓
回复: 5

哪位高手教教我,怎么用IAR的调试功能调试出每条指令所用的时间啊?

[复制链接]

出0入0汤圆

发表于 2011-3-20 02:47:24 | 显示全部楼层 |阅读模式
哪位高手教教我,怎么用IAR的调试功能调试出每条指令所用的时间啊?我想算出非常精确的时间....   我现在用的是msp430f149.我是新手,谢谢!

阿莫论坛20周年了!感谢大家的支持与爱护!!

知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)

出0入0汤圆

 楼主| 发表于 2011-3-20 22:10:16 | 显示全部楼层
高手大哥大姐们,求救啊!!

出0入0汤圆

 楼主| 发表于 2011-3-21 22:48:59 | 显示全部楼层
是不是高手们都觉得这个问题很幼稚啊?

出0入0汤圆

发表于 2011-6-1 12:05:36 | 显示全部楼层
#define CPU_F ((double)1000000)
#define delay_us(x) __delay_cycles((long)(CPU_F*(double)x/1000000.0))
#define delay_ms(x) __delay_cycles((long)(CPU_F*(double)x/1000.0))
用这个吧

出0入0汤圆

发表于 2011-6-1 12:07:41 | 显示全部楼层
__delay_cycles()
在intrinsics.h 里

出0入0汤圆

发表于 2011-6-1 12:09:15 | 显示全部楼层
/**************************************************
*
* Intrinsic functions for the IAR Embedded Workbench for MSP430.
*
* Copyright 2002-2006 IAR Systems. All rights reserved.
*
* $Revision: 4055 $
*
**************************************************/

#ifndef __INTRINSICS_H
#define __INTRINSICS_H

#ifndef _SYSTEM_BUILD
  #pragma system_include
#endif

#pragma language=save
#pragma language=extended

/*
* The return value of "__get_interrupt_state".
*/

typedef unsigned short istate_t;


#ifdef __cplusplus
extern "C"
{
#endif

  __intrinsic void __no_operation(void);
  __intrinsic void __enable_interrupt(void);
  __intrinsic void __disable_interrupt(void);

  __intrinsic istate_t __get_interrupt_state(void);
  __intrinsic void     __set_interrupt_state(istate_t);

  __intrinsic void __op_code(unsigned short);

  __intrinsic unsigned short __swap_bytes(unsigned short);

  __intrinsic void           __bic_SR_register(unsigned short);
  __intrinsic void           __bis_SR_register(unsigned short);
  __intrinsic unsigned short __get_SR_register(void);

  __intrinsic void           __bic_SR_register_on_exit(unsigned short);
  __intrinsic void           __bis_SR_register_on_exit(unsigned short);
  __intrinsic unsigned short __get_SR_register_on_exit(void);

  __intrinsic unsigned short     __bcd_add_short(unsigned short,
                                                 unsigned short);

  __intrinsic unsigned long      __bcd_add_long (unsigned long,
                                                 unsigned long);

  __intrinsic unsigned long long __bcd_add_long_long(unsigned long long,
                                                     unsigned long long);

  /*
   * Support for efficient switch:es. E.g. switch(__even_in_range(x, 10))
   *
   * Note that the value must be even and in the range from 0 to
   * __bound, inclusive. No code will be generated that checks this.
   *
   * This is typically used inside interrupt dispatch functions, to
   * switch on special processor registers like TAIV.
   */

  __intrinsic unsigned short __even_in_range(unsigned short __value,
                                             unsigned short __bound);

  /* Insert a delay with a specific number of cycles. */
  __intrinsic void __delay_cycles(unsigned long __cycles);

  /*
   * The following R4/R5 intrinsic functions are only available when
   * the corresponding register is locked.
   */

  __intrinsic unsigned short __get_R4_register(void);
  __intrinsic void           __set_R4_register(unsigned short);

  __intrinsic unsigned short __get_R5_register(void);
  __intrinsic void           __set_R5_register(unsigned short);

  __intrinsic unsigned short __get_SP_register(void);
  __intrinsic void           __set_SP_register(unsigned short);



  /* ----------------------------------------
   * MSP430X-specific intrinsic functions.
   */

  /*
   * Intrinsic functions to allow access to the full 1 Mbyte memory
   * range in small data model.
   *
   * The functions are available in medium and large data model
   * aswell, however it is recommended to access memory using normal
   * __data20 variables and/or pointers.
   *
   * Please note that interrupts must be disabled when the following
   * intrinsics are used.
   */

  __intrinsic void __data20_write_char (unsigned long  __addr,
                                        unsigned char  __value);

  __intrinsic void __data20_write_short(unsigned long  __addr,
                                        unsigned short __value);

  __intrinsic void __data20_write_long (unsigned long  __addr,
                                        unsigned long  __value);

  __intrinsic unsigned char  __data20_read_char (unsigned long __addr);
  __intrinsic unsigned short __data20_read_short(unsigned long __addr);
  __intrinsic unsigned long  __data20_read_long (unsigned long __addr);

  /*
   * The following two functions can be used to access 20-bit SFRs in the
   * lower 64kB. They are only available in extended mode (--core=430X).
   */
  __intrinsic void __data16_write_addr (unsigned short __addr,
                                        unsigned long  __value);

  __intrinsic unsigned long  __data16_read_addr (unsigned short __addr);


#ifdef __cplusplus
}
#endif


/*
* Alias for locations used for global register variables.  For example,
* "__no_init __regvar int x @ __R4;".
*/

#define __R4 4
#define __R5 5

/*
* Control bits in the processor status register, SR.
*/

#define __SR_GIE     (1<<3)
#define __SR_CPU_OFF (1<<4)
#define __SR_OSC_OFF (1<<5)
#define __SR_SCG0    (1<<6)
#define __SR_SCG1    (1<<7)


/*
* Functions for controlling the processor operation modes.
*/

#define __low_power_mode_0() (__bis_SR_register(  __SR_GIE      \
                                                | __SR_CPU_OFF))

#define __low_power_mode_1() (__bis_SR_register(  __SR_GIE      \
                                                | __SR_CPU_OFF  \
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-7-28 14:36

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表