---
# System prepended metadata

title: Main Function
tags: [Robot id, ' software', ' Main Function']

---

---
tags: Robot id, software, Main Function
---

Main Function
===

### Initial
```C++=
#include "MotionCard.h"
#include <iostream>
#include <conio.h>

//===============================================================

void _stdcall Timer_DAC(TMRINT *pstINTSource);

//===============================================================

int main()
{
	//-------------------- 開啟各項功能 --------------------
	printf("Press 'Esc' to end program.\n");

	MotionCard_OpenCard(); // 開啟軸卡

	//---------------------- 工作流程 ----------------------
	int sw = 0;

	while (sw != 0x1b)
	{
		//-------------------- 手動結束程式 --------------------
		if (_kbhit())
		{
			sw = _getch(); // 按ESC結束程式
		}

		//---------------------- 切換中斷 ----------------------

	}

	//-------------------- 關閉各項功能 --------------------
	MotionCard_CloseCard(); // 關閉軸卡
}

```