#include #include #include #include /* Needed if linking in external compiler; harmless otherwise */ #include #include "pdi5025.h" #include "pdi5025ui.h" int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow) { int pdi5025_ID; double vt[5000]; int board; int i; int index; long int count; if (InitCVIRTE(hInstance, 0, 0) == 0) /* Needed if linking in external compiler; harmless otherwise */ return -1; /* out of memory */ /* Only execute these statements if testing with hardware */ #ifndef DUMMY_DEVICES board = ibfind("GPIB0"); ibsic(board); #endif pdi5025_init(0, 13, &pdi5025_ID); //pdi5025ui_init(pdi5025_ID); /* Try some things with a linear encoder */ pdi5025_set_linear_encoder_trigger(pdi5025_ID, 0); //index = pdi5025_locate_index (pdi5025_ID); //printf("Index = %i\n", index); //pdi5025_zero_encoder_counter(pdi5025_ID); for (i=1; i<=10; i++) { pdi5025_get_encoder_count(pdi5025_ID, &count); printf("%li\n", count); Delay(1.); } //pdi5025_get_VT_linear_encoder(pdi5025_ID, 'A', 2, '+', +1, 10, 1000, vt); pdi5025_get_VT_linear_encoder_start(pdi5025_ID, 'A', 2, '+', +1, 10, 1000); pdi5025_get_VT_linear_encoder_finish(pdi5025_ID, 1000, vt); for(i=0; i<=10; i++) printf("vt[%i] = %f\n", i, vt[i]); for (i=1; i<=10; i++) { pdi5025_get_encoder_count(pdi5025_ID, &count); printf("%li\n", count); Delay(1.); } Delay(5.); /* Try some things with a rotary encoder */ /* pdi5025_set_rotary_encoder_trigger(pdi5025_ID, 1024); index = pdi5025_locate_index (pdi5025_ID); printf("Index = %i\n", index); pdi5025_get_VT_rotary_encoder(pdi5025_ID, 'A', 2, '+', 2, 12, vt); exit(0); pdi5025_get_VT_timer(pdi5025_ID, 'A', 2, 1., 10, vt); for(i=0; i<=10; i++) printf("vt[%i] = %f\n", i, vt[i]); pdi5025_close(pdi5025_ID); */ /* Try some things with the timer */ //RunUserInterface(); return 0; }