请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
主题中讨论的其他器件:MSP-EXP430G2、 MSP430G2553大家好、
我不熟悉论坛和 MSP430。 我有 一个 MSP430 Launchpad 修订版1.4、对当前正在构建的项目有几个问题。
我尝试使用 光晶体管和来自旧 CD 驱动器的步进电机来构建光谱仪(根据本说明)。 因此、我有一个简易驱动器分线板来完成我的脏任务。 因此、我不使用串行转 USB 分线板在 PC 和 MSP430之间进行通信、而是使用 launchpad 本身、我的第一个问题是、为了能够从 PC 向 MSP430发送串行命令、我应该移除/更改哪个跳线? 我是否必须水平改变 TXD 和 RXD 的位置(电路板为修订版1.4)?
我的第二个问题是 、关于我必须将光晶体管的发射极连接到 P1_3的说明、 但我注意到 MSP430有一个名为 P1_3的硬件按钮、我是否必须不断按下此按钮才能从 P1_3处连接的光敏电阻获取数据?
我的第三个问题是 、关于指令 、我可以使用 RST (S1)引脚作为+3V 输出、这是正确的、我是否必须更改跳线才能将 RST (S1)用作+3V 输出。
这是我的代码。
//I/O 低于
const int StepperMotor = P2_4;
const int StepperDirection = P2_5;
const int Sensor[]={P1_3};//在此处添加更多传感器!
//下面用于校准的常量!
const double nm = 405;//已知校准源频率
const double x = 37.65;//"屏幕"
上方的点距离 const double D = 50.00;//到"屏幕"
的距离 const double degerstep = 1;//步进电机的每步度
const double 微步进= 8; //这使您可以确定采样频率(反向微步进)
const double mmPerRotation = 2.76;//这是心轴两个齿之间的距离
,这两个齿使传感器上下移动,使托盘双高度= 38.00; //根据估算,位
const double starty = 32.35;//32.35
////////////////////////////////////////////////////////// 与以下各项进行分步操作、您自行承担风险!////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const double stepsperrotation = 360/脱脂;
const double microstepsundersend = heightoftraK/mmPerRotation * Stepsperrotation *(微步进);
const double d =(nm int1e-9)/sin (atan (x/D));
//const double d = 720e-9;// tamburity
= 0*0[nT = 0]nT;double turesx = 0[nT = 0]nT (nT);双精度1);双精度 d1 nT = 0*turesx (nT = 0[nT);双精度1)
const double zero = starty-x;
char KSK ='0';
void setup(){
PinMode (PUSH2、INPUT_PULLUP);
Serial.begin(9600);// Hah、我忘记添加这个、特别感谢 Tommy_goh1997发现了错误!
PinMode (StepperMotor、输出);
PinMode (StepperDirection、Output);
digitalWrite (StepperMotor、low);
digitalWrite (StepperDirection、 低电平);//重新启动时,步进电机将使传感器降低到最低。
对于(int i=i;<sizeof(wavelengthvIntensity);i++) { 0
PinMode (Sensors[i]、输入);
}
for (int i = 0;i <微步进 sutilend;i++){
digitalWrite (StepperMotor、HIGH);
delayMicroseconds (250);
digitalWrite (StepperMotor、LOW);
delayMicroseconds (250);
}
digitalWrite (StepperDirection、HIGH);
}
void loop (){
if (KSK ='1'){
KSK = 0;
CNT = 0;
while (cnt < microStepsntillend){
for (int i=0;<sizeof(wavelengthvIntensity)-1;i++) { )
波长密度[i]= analogRead (Sensors[i]);
serial.print (wavelengthvIntensity[i]);
serial.print ("、");
}
serial.println (tempnm);
digitalWrite (StepperMotor、HIGH);
delayMicroseconds (1);
digitalWrite (StepperMotor、low);
delayMicroseconds (1);
CNT++;
//Serial.println (currenty);
currenty = zero+((cnt/microstepsntend)* heightoftray);
tempnm = d*sin (atan (((x+currenty)/D))*(1e9);
}
digDirectWrite (Steppertion、low);
for (I +<stepsinte+);for (i +<0+)
digitalWrite (StepperMotor、HIGH);
delayMicroseconds (250);
digitalWrite (StepperMotor、LOW);
delayMicroseconds (250);
}
digitalWrite (StepperDirection、HIGH);
Serial.println ("$");
}
KSK = Serial.Read();
}
此致、
假面
P.S. 请原谅我的英语。 我不是本机发言人。