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.

关于MSP430F5438A与CCS调试时无法正确反映内存数据问题

Other Parts Discussed in Thread: MSP430F5529, MSP430F5438A

      你好,最近我在使用CCS5.2.0时发现如果写一个函数且参数为长整形(unsigned long int) ,调试时发现无法正确的把大于65535的数传入函数中。举个实际例子:

unsigned char SD_Read_Sector(unsigned long addr,unsigned char *buffer);//读SD卡扇区函数

使用:SD_Read_Sector(84409 , FAT32_Buffer);

//调试时进入函数观察得:

//注意到上面的数据不是我写入的84409

//读出的数据为:FAT32_Buffer[512]={0x52,0x49,0x46,0x46......}

//此外我还尝试读取18873扇区的数据,如下:

SD_Read_Sector(18873 , FAT32_Buffer);

//进入函数观察得:

//读出的数据为:FAT32_Buffer[512]={0x79,0x79,0x7A,0x7B......}

根据我对SD卡内数据的观察,这两次读取的数据都是正确的,但对第一次数据长整形数据地址addr不能正确显示让人觉得很匪夷所思。在SD_Read_Sector(unsigned long addr,unsigned char *buffer)函数内部有个针对addr的移位操作: 

addr<<=9; //sector = sector * 512   将块地址(扇区地址)转为字节地址

我发现运行过这步后addr也没有任何变化,让人很是奇怪,但偏偏结果也没出什么问题,真是奇怪啊。谢谢耐心看完我的唠叨,真心希望能知道出现这些现象的原因。