⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fixturecontrol.c

📁 64输入32输出单片机程序
💻 C
字号:
//---------------------------------------------------------------------------
//	Project Title : Armature resistance tester for stator.
//	  Project No. : 
//	 Project Ver. : 1.00
//	    File Name : FixtureControl.c
//	     Revision : 1.00
//	 Initial Date : 22-Oct,2002
//	  Modify Date : 09-Dec,2003
//	  Description : 
#include <..\atmel\at89s53.h>
#include <absacc.h>
#include <stdio.h>
#include <string.h>
#include <dom12a.h>

#define EXT_OUTP0	0x01
#define EXT_OUTP1	0x02
#define EXT_OUTP2	0x04
#define EXT_OUTP3	0x08
#define EXT_OUTP4	0x10
#define BUZZER		0x20
#define FAIL_LAMP	0x40
#define PASS_LAMP	0x80

#define START_SW	0x01
#define EXT_INP1	0x02
#define EXT_INP2	0x04
#define EXT_INP3	0x08
#define EXT_INP4	0x10
#define EXT_INP5	0x20

extern char _set_extoutp (char f, char s);
extern char _get_extinp (char f);

extern void	msDelay(unsigned int timer_count);

//local func.
uchar Fixture_Sequence_Control(uchar flagPass, uchar FCM);
uchar start_Fixture_control(uchar FCM);

//**********************************************************
uchar start_Fixture_control(uchar FCM)
{
  // OUTP0 --- Test needle
  // OUTP1 --- PUSHUP
  FCM = FCM;
  msDelay(1000);					// delay 1000ms
  _set_extoutp(EXT_OUTP0, ON);	// Test needle contact the armature
  msDelay(300);
  //if ( !FCM)
  //		_set_extoutp(EXT_OUTP1,ON);	
  //msDelay(300);
  return (0);
} // end func.

//**********************************************************
uchar Fixture_Sequence_Control(uchar flagPass, uchar FCM)
{
  if ( flagPass ) {
	 switch (FCM) { 
	 	case 0: //mode 0
			_set_extoutp( EXT_OUTP0, OFF); 		// test needle remove
			msDelay(500);
			_set_extoutp( EXT_OUTP1, ON); 		// Pushup on
			msDelay(1000);
			_set_extoutp( EXT_OUTP1, OFF);      // Pushup off
			while ( !_get_extinp(START_SW ));	// wait if START signal still on(active low
			msDelay(100);
			break;
	 	case 1:	// mode 1
			_set_extoutp( EXT_OUTP0, OFF); 		// top pistol remove
			while ( !_get_extinp(START_SW ));	// wait if START signal still on(active low
			msDelay(100);
			break;
	 } // end switch
  } else { // Test failed
		if ( !FCM ) { // mode 0
			while ( _get_extinp( EXT_INP1 ) ); //reset hitted 
			msDelay(300);
			_set_extoutp( EXT_OUTP0, OFF); // test needle remove	
		} else
			_set_extoutp( EXT_OUTP1, OFF); // test needle remove
  } // end else

  return (0);
} // end func.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -