Ejemplo n.º 1
0
Archivo: main.c Proyecto: wakaw/bws
//// 4.速度ステップ入力 ////////////////////////////////////////////////
void Velocity_Step(void)
{
	int Flag=1;
	int yes;
	int ch;
	
	while(Flag){
		Display_Title();											//タイトル表示
		printf(" <Velocity Step Response Test Menu>\n");			//サブタイトル表示
		Sensors_Display();
		
		printf("\n Input Channel (1 or 2) >> ");					//チャンネル入力
		ch = Int_Stdin(1,2);
		
		printf("\n Input RPM 1 (-830 - 830)[RPM]) >> ");			//回転数入力
		M[ch].Target_RPM1 = Double_Stdin(-830,830);
		M[ch].DA_Value1 = (M[ch].Target_RPM1*0.003+2.5057)/5.0*4095.0;			//valueに変換
		
		printf("\n Input RPM 2 (-830 - 830)[RPM]) >> ");			//回転数入力
		M[ch].Target_RPM2 = Double_Stdin(-830,830);
		M[ch].DA_Value2 = (M[ch].Target_RPM2*0.003+2.5057)/5.0*4095.0;			//valueに変換
		
		printf("\n Input Sampling Cycle (1-100)[msec] >>");
		Samp_Cycle = Int_Stdin(1,100);
		
		M[ch].Counter_Past = Count_Read(ch);						//カウンタ初期値
		Rec_Time = 2.0;
		
		File_Open();												//ファイルオープン
		Step_h(ch);
		////////////////////////////////////////////////////////////////////////
		Timer2(Samp_Cycle,Rec_Time,Step_Drive1,ch);					//タイマon
		Timer2(Samp_Cycle,Rec_Time,Step_Drive2,ch);					//タイマon
		////////////////////////////////////////////////////////////////////////
		DA_Write(ch,2048);											//2.5V出力
		File_Close();												//ファイルクローズ
		
		sleep(1);
		Savexy();
		Sensors_Display();
		Returnxy();													//カーソル位置復帰
		printf("\n Now Check is End. Again? -- Y or N >> ");
		yes = Yes_or_No();
		if(yes=='n')Flag=0;
	}
}
Ejemplo n.º 2
0
Archivo: main.c Proyecto: wakaw/bws
//// 6.免荷一定制御(2モータ) ////////////////////////////////////////////////
void Force_Const_2(void)
{
	int Flag=1;
	int yes;
	int ch;
	
	while(Flag){
		Display_Title();											//タイトル表示
		printf(" <Constant Force Control Test Menu>\n");			//サブタイトル表示
		Sensors_Display();
		
		printf("\n Input Target Force (0 - 500)[N]) >> ");			//回転数入力
		M[1].Target_Force = Double_Stdin(0,500);
		M[2].Target_Force = Double_Stdin(0,500);
		
		printf("\n Input Gain (UP) (0 - )[rpm/N]) >> ");			//ゲイン入力(のぼり)
		M[1].Gain1 = Double_Stdin(0,1000);
		M[2].Gain1 = Double_Stdin(0,1000);
		
		printf("\n Input Gain (DOWN) (0 - )[rpm/N]) >> ");			//ゲイン入力(くだり)
		M[1].Gain2 = Double_Stdin(0,1000);
		M[2].Gain2 = Double_Stdin(0,1000);
		
		Input_Timer_Parameter();									//サンプリング間隔と記録時間を入力
		
		M[1].Counter_Past = Count_Read(1);						//カウンタ初期値
		M[2].Counter_Past = Count_Read(2);
		
		File_Open();												//ファイルオープン
		Force_Const_h2();
		////////////////////////////////////////////////////////////////////////
		Timer2(Samp_Cycle,Rec_Time,Force_Const_Drive2,1);			//タイマon
		////////////////////////////////////////////////////////////////////////
		DA_Write(1,2048);											//2.5V出力
		DA_Write(2,2048);
		File_Close();												//ファイルクローズ
		
		sleep(1);
		Savexy();
		Sensors_Display();
		Returnxy();													//カーソル位置復帰
		printf("\n Now Check is End. Again? -- Y or N >> ");
		yes = Yes_or_No();
		if(yes=='n')Flag=0;
	}
}
Ejemplo n.º 3
0
void CSerialModem::handleUpperEvent(Bit16u type) {
	switch (type) {
	case SERIAL_RX_EVENT: {
		// check for bytes to be sent to port
		if(CSerial::CanReceiveByte())
			if(rqueue->inuse() && (CSerial::getRTS()||(flowcontrol!=3))) {
				Bit8u rbyte = rqueue->getb();
				//LOG_MSG("Modem: sending byte %2x back to UART3",rbyte);
				CSerial::receiveByte(rbyte);
			}
		if(CSerial::CanReceiveByte()) setEvent(SERIAL_RX_EVENT, bytetime*0.98f);
		break;
	}
	case MODEM_TX_EVENT: {
		if (tqueue->left()) {
			tqueue->addb(waiting_tx_character);
			if (tqueue->left() < 2) {
				CSerial::setCTS(false);
			}
		} else {
			static Bits lcount=0;
			if (lcount<1000) {
				lcount++;
				LOG_MSG("MODEM: TX Buffer overflow!");
			}
		}
		ByteTransmitted();
		break;
	}
	case SERIAL_POLLING_EVENT: {
		if (rqueue->inuse()) {
			removeEvent(SERIAL_RX_EVENT);
			setEvent(SERIAL_RX_EVENT, (float)0.01);
		}
		Timer2();
		setEvent(SERIAL_POLLING_EVENT,1);
		break;
	}

	case MODEM_RING_EVENT: {
		break;
	}
	}
}
Ejemplo n.º 4
0
Archivo: main.c Proyecto: wakaw/bws
//// 3.速度のチェック ////////////////////////////////////////////////
void Velocity_Check(void)
{
	int Flag=1;
	int yes;
	int ch;
	double Voltage;
	int value;

	while(Flag){
		Display_Title();											//タイトル表示
		printf(" <Velocity Check Menu>\n");							//サブタイトル表示
		Sensors_Display();
		
		printf("\n Input Channel (1 or 2) >> ");					//チャンネル入力
		ch = Int_Stdin(1,2);		
		printf("\n Input Voltage (0 - 5.0)[V]) >> ");				//電圧入力
		Voltage = Double_Stdin(0,5);
		Input_Timer_Parameter();									//サンプリング間隔と記録時間を入力
		
		value = Voltage / 5.0 * 4095.0;								//valueに変換

		M[ch].Counter_Past = Count_Read(ch);						//カウンタ初期値
		
		DA_Write(ch,value);											//出力
		///////////////////////////////////////////////
		Timer2(Samp_Cycle,Rec_Time,Velocity_Display,ch);			//タイマon
		DA_Write(ch,2048);											//2.5V出力
		sleep(1);
		Savexy();
		Sensors_Display();
		Returnxy();													//カーソル位置復帰
		printf("\n Now Check is End. Again? -- Y or N >> ");
		yes = Yes_or_No();
		if(yes=='n')Flag=0;
	}
}