您好,
我正在使用MSP430FR5730将摄像机闪光灯计数器存储在FRAM中。 counter和start_flag都是noinit变量,并存储在FRAM中。 以下代码在模拟中工作正常,但当触发真实的相机闪存时,它不起作用。 我切换了一个引脚,以确保边缘检测逻辑工作正常。 当闪光时,我每次都能看到示波器上的针脚切换。 但是,计数器从未改变。
这是否意味着FRAM不能在可能有少许噪音的环境中使用? 或者我在这里错过了什么?
谢谢
彭
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//在.cmd文件
//.TI.noinit中:{}> fram /*用于#pragma noinit *
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
========= 标准MSP430包括=========
*/
#include <MSP4S.h>
/*
========= Grace Related includes =========
*/
#include <ti/MCU/MSP4I/Grace.h>
#include "stdint.h"
#include "driverlib.h"
#include "board.h"
/*
========= 主====
*/
#pragma NOINIT (counter)
uint16_t计数器;
#pragma NOINIT (start_flag)
uint16_t start_flag;
int main (void)
{
Grace初始化();//激活Grace生成的配置
//>>> 在此处填写用户代码<<<<
UINT8_t port1,port1_delay;
uint8_t i;
//init计数器位于空白板
上IF (start_flag!= 0x1298){
start_flag=0x1298;
counter=0;
}
gPIO_setOutputLowOnPin (GPIO_PORT_P2,gPIO_PIN4);
端口1=1;
端口1_DELAY 1= 1;
while (1){
port1=P2IN & BIT6;
if ((port1_delay!=0)&&(port1==0)){//为
(i=0;i<100;i++)下降边缘;//延迟约1us
端口1=P2IN和BIT6;//再次验证引脚状态以消除抖动;
gPI_outpin;pin;pb1
;检测到pip_debugu_1=;gPI_outpin;gPI=10;gPI_outback;gPI_outpin;gPI=10+
gPIO_setOutputLowOnPin(GPIO_PORT_P2,gPIO_PIN4);
}
port1_delay=port1;
}
返回(0);
}