//********************************************// // i-87123 for i-8000 series test program // // Controll I/O with PDO message // // // //********************************************// #include #include #include #include "..\lib\8000e.h" #include "..\lib\I87123.h" void main(void) { int ret; int slot,baud; char command; Print("\r\n"); Print("/************************/\r\n"); Print("/*Library Version = %.02f*/\r\n",I87123_GetVersion()); Print("/************************/\r\n"); Print("i-87123 slot(0~7):"); Scanf("%d\r\n",&slot); Print("0:10Kbps 4:250Kbps\r\n"); Print("1:20Kbps 5:500Kbps\r\n"); Print("2:50Kbps 6:800Kbps\r\n"); Print("3:125Kbps 7:1000Kbps\r\n"); Print("i-87123 baud(0~7):"); Scanf("%d\r\n",&baud); ChangeToSlot(slot); // change slot to i-87123 ret = I87123_Configure((unsigned char)baud); // Configure i-87123 Baudrate if(ret){ Print("Configure error, Error Code = %d\r\n",ret); Print("Press any key to exit program"); Getch(); return; } else{ Print("Configure OK\r\n"); } Print("a. Add Node:\r\n"); Print("b. Remove Node:\r\n"); Print("c. Remote Data:\r\n"); Print("d. Output Data:\r\n"); Print("q. Shutdown and exit:\r\n:"); while(1){ { int i; unsigned char node; unsigned short cobid; unsigned char len; unsigned char rdata[40]; ret = I87123_MsgResponse(&node, &cobid, &len, rdata); // Receive response message if(ret != I87123_EMPTY){ if(ret == I87123_OK){ // Receive PDO response message Print("\rPDO: "); Print("[%X] ",cobid); for(i=0;i