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.

[参考译文] MSP430FR2355:驱动程序范围问题?

Guru**** 2511415 points


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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1164461/msp430fr2355-driver-scope-issue

器件型号:MSP430FR2355

你好。。。

我在驱动程序中有一个结构,我尝试通过 strncpy 将值分配给...使用断点进行调试时,源代码看起来不错,但是,对目标的分配永远不会发生...所有目标都包含0xFF。  我 不确定如何正确执行赋值、我希望能够使用 main 中结构的值。  以下是"我认为的"相关代码段。  我似乎在努力解决范围问题.

main.c (此处是在驱动程序中分配的声明和函数 call....no 定义?)

gpsMssg_s *pGPSData;

GPSMssgParser(pGPSData);

driver.h  

typedef struct gpsLogValues
{
    char utc[15];
    char latitude[15];
    char longitude[15];
    char date[10];
    char satellites[3];
}gpsLogValues_s;


typedef struct gpsData
{
    gpsLogValues_s *gpsLog;
}gpsMssg_s;

driver.c (分配)

                    strncpy(pGPS_d->gpsLog->utc, &NMEAData[7], 10);
                    strncpy(pGPS_d->gpsLog->date, &NMEAData[57], 6);
                    strncpy(pGPS_d->gpsLog->latitude, &NMEAData[20], 11);
                    strncpy(pGPS_d->gpsLog->longitude, &NMEAData[32], 12);

NMEAData 在断点处看起来不错...只是似乎无法使分配保持...????

谢谢