SESTILIO  3.0.2
C Library for SESTILIO a smart A/D and D/A interface on USB 2.0
sestilio.cpp
1 #include <Windows.h>
2 #include "stdio.h"
3 #include "ftd2xx.h"
4 #include "sest.h"
5 
6 
7 static DWORD numDevs;
8 static FT_HANDLE ftHandle[128];
9 static char seId[128];
10 static int status[128];
11 static char * _buf;
12 static char * __buf;
13 
14 CTYPE int DLL SE_Open(char sestilioId, int usbDevice)
15 {
16  FT_STATUS ftStatus;
17  int ret = SE_S_FAIL;
18 
19  seId[usbDevice] = sestilioId;
20  ftStatus = FT_ListDevices(&numDevs, NULL, FT_LIST_NUMBER_ONLY);
21  if(ftStatus == FT_OK && numDevs > 0)
22  {
23  ftStatus = FT_Open(usbDevice, &ftHandle[usbDevice]);
24  if(ftStatus == FT_OK)
25  {
26  //FT_SetLatencyTimer(ftHandle[usbDevice], 2);
27  FT_SetUSBParameters(ftHandle[usbDevice], 512, 512);
28  FT_Purge(ftHandle[usbDevice], FT_PURGE_RX);
29  FT_Purge(ftHandle[usbDevice], FT_PURGE_TX);
30  ret = SE_S_SUCCESS;
31  _buf = new char[65536];
32  __buf = 0;
33  }
34  }
35  return ret;
36 }
37 
38 CTYPE int DLL SE_Close(int usbDevice)
39 {
40  int ret = SE_S_FAIL;
41  if(FT_Close(ftHandle[usbDevice]) == FT_OK)
42  ret = SE_S_SUCCESS;
43  if(__buf) delete [] __buf;
44  delete [] _buf;
45  return ret;
46 }
47 
48 CTYPE unsigned DLL SE_NumOfDevices()
49 {
50  return numDevs >> 1;
51 }
52 
53 CTYPE int DLL SE_Status(int usbDevice)
54 {
55  return status[usbDevice];
56 }
57 
58 CTYPE const char DLL_P SE_ReadData(const char * command, int rxed, int usbDevice)
59 {
60  DWORD bw, timeout = 100;
61  char * ret;
62  // Build the string to send
63  sprintf(_buf, " %c%s\r", seId[usbDevice], command);
64  // Add to the string length SYNC,ID,TERMINATOR
65  rxed += 3;
66  FT_Write(ftHandle[usbDevice], _buf, strlen(_buf), &bw);
67  do
68  {
69  Sleep(2);
70  FT_GetQueueStatus(ftHandle[usbDevice], &bw);
71  timeout--;
72  }while(bw < rxed && timeout > 0);
73  if(timeout)
74  FT_Read(ftHandle[usbDevice], _buf, rxed, &bw);
75  if(rxed == bw)
76  {
77  status[usbDevice] = SE_S_SUCCESS;
78  _buf[rxed - 1] = 0; // Blank the CR
79  ret = &_buf[2]; // Skip sync and id
80  }
81  else
82  {
83  ret = 0;
84  status[usbDevice] = SE_S_FAIL;
85  FT_Purge(ftHandle[usbDevice], FT_PURGE_RX);
86  }
87  return ret;
88 }
89 
90 CTYPE const char DLL_P SE_ReadDataBinary(const char * command, int rxed, int usbDevice)
91 {
92  DWORD bw, timeout = 100;
93  // Build the string to send
94  sprintf(_buf, " %c%s\r", seId[usbDevice], command);
95  FT_Write(ftHandle[usbDevice], _buf, strlen(_buf), &bw);
96  do
97  {
98  Sleep(2);
99  FT_GetQueueStatus(ftHandle[usbDevice], &bw);
100  timeout--;
101  }while(bw < rxed && timeout > 0);
102  if(timeout)
103  FT_Read(ftHandle[usbDevice], _buf, rxed, &bw);
104  //FT_GetQueueStatus(ftHandle[usbDevice], &bw);
105  if(rxed == bw)
106  status[usbDevice] = SE_S_SUCCESS;
107  else
108  {
109  status[usbDevice] = SE_S_FAIL;
110  FT_Purge(ftHandle[usbDevice], FT_PURGE_RX);
111  }
112  return _buf;
113 }
114 
115 CTYPE int DLL SE_ReadDataBinaryExt(const char * command, char * outBuf, int rxed, int usbDevice)
116 {
117  DWORD bw;
118  // Build the string to send
119  sprintf(_buf, " %c%s\r", seId[usbDevice], command);
120  FT_Write(ftHandle[usbDevice], _buf, strlen(_buf), &bw);
121  FT_Read(ftHandle[usbDevice], outBuf, rxed, &bw);
122  //FT_GetQueueStatus(ftHandle[usbDevice], &bw);
123  if(rxed == bw)
124  status[usbDevice] = SE_S_SUCCESS;
125  else
126  status[usbDevice] = SE_S_FAIL;
127  return status[usbDevice];
128 }
129 
130 CTYPE int DLL SE_WriteDataBinary(const char * command, const char * buffer, unsigned length, int usbDevice)
131 {
132  DWORD bw;
133  int ret = SE_S_FAIL;
134  // Build the string to send
135  sprintf(_buf, " %c%s\r", seId[usbDevice], command);
136  FT_Write(ftHandle[usbDevice], _buf, strlen(_buf), &bw);
137  FT_Read(ftHandle[usbDevice], _buf, 4, &bw);
138  if(bw == 4 && _buf[2] == '.')
139  ret = SE_S_SUCCESS;
140  status[usbDevice] = ret;
141  FT_Write(ftHandle[usbDevice], (char *) buffer, length, &bw);
142  return ret;
143 }
144 
145 CTYPE long DLL SE_ReadDataNumber(const char * command, int rxed, int usbDevice)
146 {
147  const char * ret = SE_ReadData(command, rxed, usbDevice);
148  if(ret)
149  return atol(ret);
150  return 0;
151 }
152 
153 CTYPE int DLL SE_Command(const char * command, int usbDevice)
154 {
155  char buf[128];
156  DWORD bw;
157  int ret = SE_S_FAIL;
158  // Build the string to send
159  sprintf(buf, " %c%s\r", seId[usbDevice], command);
160  FT_Write(ftHandle[usbDevice], buf, strlen(buf), &bw);
161  FT_Read(ftHandle[usbDevice], buf, 4, &bw);
162  if(bw == 4 && buf[2] == '.')
163  ret = SE_S_SUCCESS;
164  status[usbDevice] = ret;
165  FT_Purge(ftHandle[usbDevice], FT_PURGE_RX);
166  return ret;
167 }
168 
169 CTYPE void DLL SE_CommandDeaf(const char * command, int usbDevice)
170 {
171  char buf[128];
172  DWORD bw;
173  // Build the string to send
174  sprintf(buf, " %c%s\r", seId[usbDevice], command);
175  FT_Write(ftHandle[usbDevice], buf, strlen(buf), &bw);
176 }
177 
178 CTYPE int DLL SE_CheckAck(int usbDevice)
179 {
180  char buf[128];
181  DWORD bw;
182  int ret = SE_S_RUN;
183  FT_GetQueueStatus(ftHandle[usbDevice], &bw);
184  if(bw == 4)
185  {
186  FT_Read(ftHandle[usbDevice], buf, 4, &bw);
187  if(bw == 4 && buf[2] == '.')
188  ret = SE_S_SUCCESS;
189  }
190  status[usbDevice] = ret;
191  return ret;
192 }
193 
194 CTYPE int DLL SE_SetID(char sestilioId, int usbDevice)
195 {
196  char buf[32];
197  sprintf(buf, "I%c", sestilioId);
198  seId[usbDevice] = sestilioId;
199  return SE_Command(buf, usbDevice);
200 }
201 
202 CTYPE int DLL SE_SetMux(int chan, int usbDevice)
203 {
204  char buf[32];
205  int ad = 0;
206  if(chan > 7) { ad = 1; chan -= 8; }
207  // Select the multiplexer channel
208  sprintf(buf, "c%d%d", ad, chan);
209  return SE_Command(buf, usbDevice);
210 }
211 
212 CTYPE unsigned short int DLL SE_ReadAnalog(int source, int average, int usbDevice)
213 {
214  char buf[32];
215  const char * ret;
216  sprintf(buf, "a%d%05d", source, average);
217  ret = SE_ReadData(buf, 5, usbDevice);
218  if(ret)
219  return (unsigned short int) atol(ret);
220  return 0;
221 }
222 
223 CTYPE int DLL SE_WriteAnalog(int chan, int value, int usbDevice)
224 {
225  char buf[32];
226  sprintf(buf, "d%d%04d", chan, value);
227  return SE_Command(buf, usbDevice);
228 }
229 
230 CTYPE int DLL SE_WriteAnalogDual(int val0, int val1, int usbDevice)
231 {
232  char buf[32];
233  sprintf(buf, "D%04d%04d", val0, val1);
234  return SE_Command(buf, usbDevice);
235 }
236 
237 CTYPE int DLL SE_FastWriteAnalog(int source, int trigger, unsigned period, int samples, int usbDevice)
238 {
239  char buf[32];
240  sprintf(buf, "f%d%d%010d%05d", source, trigger, period, samples);
241  return SE_Command(buf, usbDevice);
242 }
243 
244 CTYPE int DLL SE_SetGain(int chan, int gain, int usbDevice)
245 {
246  char buf[32];
247  int ad = 0;
248  if(chan > 7) { ad = 1; chan -= 8; }
249  sprintf(buf, "g%d%d", ad, gain);
250  return SE_Command(buf, usbDevice);
251 }
252 
253 CTYPE int DLL SE_FastReadAnalog(int source, int trigger, unsigned period, int samples, int usbDevice)
254 {
255  char buf[128];
256  sprintf(buf, "S%d%d%010d%05d", source, trigger, period, samples);
257  return SE_Command(buf, usbDevice);
258 }
259 
260 CTYPE int DLL SE_FlowReadAnalog(int source, unsigned int num, unsigned short int * outBuffer, int usbDevice)
261 {
262  char buf[128];
263  sprintf(buf, "b%d%010d", source, num);
264  return SE_ReadDataBinaryExt(buf, (char *) outBuffer, num << 1, usbDevice);
265 }
266 
267 CTYPE const char DLL_P SE_ReadRAM(int source, int address, int num, int usbDevice)
268 {
269  char buf[128];
270  sprintf(buf, "R@%d%05u%05u", source, address, num);
271  return SE_ReadDataBinary(buf, num, usbDevice);
272 }
273 
274 CTYPE int DLL SE_WriteRAM(int source, int address, int num, const char * buffer, int usbDevice)
275 {
276  char buf[128];
277  sprintf(buf, "r@%d%05u%05u", source, address, num);
278  return SE_WriteDataBinary(buf, (const char *) buffer, num, usbDevice);
279 }
280 
281 CTYPE int DLL SE_PutSampleData(int source, int address, int num, unsigned short int * outBuffer, int usbDevice)
282 {
283  return SE_WriteRAM(source, address, num << 1, (const char *) outBuffer, usbDevice);
284 }
285 
286 CTYPE int DLL SE_GetSampleData(int source, int address, int num, unsigned short int * outBuffer, int usbDevice)
287 {
288  memcpy((void *) outBuffer, (void *) SE_ReadRAM(source, address, num << 1, usbDevice), num << 1);
289  return status[usbDevice];
290 }
291 
292 CTYPE int DLL SE_GetSampleDoubleData(int source, int address, int num, double * outBuffer, int usbDevice)
293 {
294  int i;
295  unsigned short int * ptr = (unsigned short int *) _buf;
296  SE_ReadRAM(source, address, num << 1, usbDevice);
297  if(status[usbDevice] == SE_S_SUCCESS)
298  for(i = 0; i < num; i++)
299  outBuffer[i] = (double) ptr[i];
300  return status[usbDevice];
301 }
302 
303 CTYPE int DLL SE_GetSampleDoubleDataSplit(int source, int address, int num, double * outBuffer0, double * outBuffer1, int usbDevice)
304 {
305  int i;
306  unsigned short int * ptr = (unsigned short int *) _buf;
307  SE_ReadRAM(source, address, num << 2, usbDevice);
308  if(status[usbDevice] == SE_S_SUCCESS)
309  for(i = 0; i < num; i++)
310  {
311  outBuffer0[i] = (double) ptr[i * 2];
312  outBuffer1[i] = (double) ptr[i * 2 + 1];
313  }
314  return status[usbDevice];
315 }
316 
317 CTYPE unsigned DLL SE_Counts(int usbDevice)
318 {
319  return (unsigned) SE_ReadDataNumber("N", 5, usbDevice);
320 }
321 
322 CTYPE int DLL SE_ClrCounts(int usbDevice)
323 {
324  return SE_Command("M", usbDevice);
325 }
326 
327 CTYPE int DLL SE_FirmwareRev(int usbDevice)
328 {
329  return SE_ReadDataNumber("?", 3, usbDevice);
330 }
331 
332 CTYPE int DLL SE_CPUtemperature(int usbDevice)
333 {
334  return SE_ReadDataNumber("t", 3, usbDevice);
335 }
336 
337 CTYPE int DLL SE_WriteKPortConfig(int regAdd, int regValue, int usbDevice)
338 {
339  char buf[32];
340  sprintf(buf, "p%02d%03d", regAdd, regValue);
341  return SE_Command(buf, usbDevice);
342 }
343 
344 CTYPE int DLL SE_ReadKPortConfig(int regAdd, int usbDevice)
345 {
346  char buf[32];
347  sprintf(buf, "P%02d", regAdd);
348  return SE_ReadDataNumber(buf, 3, usbDevice);
349 }
350 
351 CTYPE int DLL SE_SetPortDirection(int port, int bit7, int bit6, int bit5, int bit4, int bit3, int bit2, int bit1, int bit0, int usbDevice)
352 {
353  char buf[32];
354  int dir = bit0;
355  dir += (bit1 << 1);
356  dir += (bit2 << 2);
357  dir += (bit3 << 3);
358  dir += (bit4 << 4);
359  dir += (bit5 << 5);
360  dir += (bit6 << 6);
361  dir += (bit7 << 7);
362  sprintf(buf, "=%d%03d", port, dir);
363  return SE_Command(buf, usbDevice);
364 }
365 
366 CTYPE int DLL SE_WritePort(int portAddress, int portValue, int usbDevice)
367 {
368  char buf[32];
369  sprintf(buf, ">%d%03d", portAddress, portValue);
370  return SE_Command(buf, usbDevice);
371 }
372 
373 CTYPE int DLL SE_SetPortBit(int portAddress, int bit, int usbDevice)
374 {
375  char buf[32];
376  int bitmask[8] = { 1, 2, 4, 8, 16, 32, 64, 128 }, ps;
377  bit &= 7;
378  ps = SE_ReadPort(portAddress, usbDevice);
379  ps |= bitmask[bit];
380  sprintf(buf, ">%d%03d", portAddress, ps);
381  return SE_Command(buf, usbDevice);
382 }
383 
384 CTYPE int DLL SE_ClrPortBit(int portAddress, int bit, int usbDevice)
385 {
386  char buf[32];
387  int bitmask[8] = { 1, 2, 4, 8, 16, 32, 64, 128 }, ps;
388  bit &= 7;
389  ps = SE_ReadPort(portAddress, usbDevice);
390  ps &= (~bitmask[bit]);
391  sprintf(buf, ">%d%03d", portAddress, ps & 0xFF);
392  return SE_Command(buf, usbDevice);
393 }
394 
395 CTYPE int DLL SE_ReadPort(int portAddress, int usbDevice)
396 {
397  char buf[32];
398  sprintf(buf, "<%d", portAddress);
399  return SE_ReadDataNumber(buf, 3, usbDevice);
400 }
401 
402 CTYPE int DLL SE_PortPulse(int port, int initialValue, int finalValue, int pulseWidth, int timeBase, int usbDevice)
403 {
404  char buf[32];
405  sprintf(buf, ";%d%03d%03d%05d%01d", port, initialValue, finalValue, pulseWidth, timeBase);
406  return SE_Command(buf, usbDevice);
407 }
408 
409 CTYPE int DLL SE_CheckPortBit(int port, int bit, int usbDevice)
410 {
411  int bitmask[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
412  int s = SE_ReadPort(port, usbDevice);
413  bit &= 7;
414  return bitmask[bit] & s;
415 }
416 
417 CTYPE const char DLL_P SE_ReadEEPROM(int address, int num, int usbDevice)
418 {
419  char buf[128];
420  int i;
421  if(num < 256)
422  {
423  sprintf(buf, "E@%06u%06u", address, num);
424  return SE_ReadDataBinary(buf, num, usbDevice);
425  }
426  if(__buf == 0)
427  __buf = new char[131072];
428  for(i = 0; i < num; i += 256)
429  {
430  sprintf(buf, "E@%06u%06u", address + i, 256);
431  memcpy(&__buf[i], SE_ReadDataBinary(buf, 256, usbDevice), 256);
432  }
433  if(num % 256)
434  {
435  sprintf(buf, "E@%06u%06u", address + i, i % 256);
436  memcpy(&__buf[i], SE_ReadDataBinary(buf, i % 256, usbDevice), i % 256);
437  }
438  return __buf;
439 }
440 
441 CTYPE int DLL SE_WriteEEPROM(int address, int num, const char * buffer, int usbDevice)
442 {
443  char buf[128];
444  int i, s;
445  if(num < 256)
446  {
447  sprintf(buf, "e@%06u%05u", address, num);
448  return SE_WriteDataBinary(buf, (const char *) buffer, num, usbDevice);
449  }
450  for(i = 0; i < num; i += 256)
451  {
452  sprintf(buf, "e@%06u%05u", address + i, 256);
453  s = SE_WriteDataBinary(buf, (const char *) &buffer[i], 256, usbDevice);
454  }
455  if(num % 256)
456  {
457  sprintf(buf, "e@%06u%05u", address + i, i % 256);
458  return SE_WriteDataBinary(buf, (const char *) &buffer[i], i % 256, usbDevice);
459  }
460  return s;
461 }
462 
463 CTYPE int DLL SE_PwmOptoCoupledPowerPort(int bitSelect, int enable, int lowWidth, int highWidth, int usbDevice)
464 {
465  char buf[32];
466  sprintf(buf, "w%d%d%03d%03d", bitSelect, enable, lowWidth, highWidth);
467  return SE_Command(buf, usbDevice);
468 }
469 
470 CTYPE int DLL SE_AuxPower(int pwrCtrl, int usbDevice)
471 {
472  char buf[32];
473  sprintf(buf, "^%d", pwrCtrl);
474  return SE_Command(buf, usbDevice);
475 }
476 
477 CTYPE int DLL SE_WriteSPI(int address, int slaveAddress, int num, const char * buffer, int usbDevice)
478 {
479  char buf[128];
480  sprintf(buf, "u@%d%d%05u", slaveAddress, address, num);
481  return SE_WriteDataBinary(buf, (const char *) buffer, num, usbDevice);
482 }
483 
484 CTYPE const char DLL_P SE_ReadSPI(int address, int slaveAddress, int num, int usbDevice)
485 {
486  char buf[128];
487  sprintf(buf, "U@%d%d%05u", slaveAddress, address, num);
488  return SE_ReadDataBinary(buf, num, usbDevice);
489 }
490 
491 CTYPE const char DLL_P SE_ReadWriteSPI(int address, int slaveAddress, int num, const char * buffer, int usbDevice)
492 {
493  DWORD bw;
494  char buf[128];
495  sprintf(buf, "~@%d%d%03u", slaveAddress, address, num);
496  SE_WriteDataBinary(buf, buffer, num, usbDevice);
497  FT_Read(ftHandle[usbDevice], _buf, num, &bw);
498  if(num == bw)
499  status[usbDevice] = SE_S_SUCCESS;
500  else
501  {
502  status[usbDevice] = SE_S_FAIL;
503  FT_Purge(ftHandle[usbDevice], FT_PURGE_RX);
504  }
505  return _buf;
506 }
507 
508 CTYPE int DLL SE_CheckSPI(int address, int slaveAddress, int usbDevice)
509 {
510  int ret;
511  char buf[128];
512  sprintf(buf, "k@%d%d", slaveAddress, address);
513  SE_ReadDataBinary(buf, 1, usbDevice);
514  ret = _buf[0];
515  return ret;
516 }
517 
518 CTYPE int DLL SE_SetClockSPI(int speed, int mode, int usbDevice)
519 {
520  char buf[128];
521  sprintf(buf, "V%d%d", speed, mode);
522  return SE_Command(buf, usbDevice);
523 }
524 
525 CTYPE int DLL SE_TransientResponse(int da, int daValue, unsigned period, int samples, int usbDevice)
526 {
527  char buf[128];
528  sprintf(buf, "n%d%04d%010d%04d", da, daValue, period, samples);
529  return SE_Command(buf, usbDevice);
530 }
531 
532 CTYPE int DLL SE_SetPID(int pidID, int controlOutput, int adChannels, int measureUnit, int targetValue, int controlMaxValue, int behavior, int usbDevice)
533 {
534  char buf[128];
535  switch(measureUnit)
536  {
537  case SE_PID_UNIT_MC: targetValue += 273150;
538  measureUnit = SE_PID_UNIT_MK;
539  break;
540  case SE_PID_UNIT_MF: targetValue = (targetValue - 32000) / 1800 + 273150;
541  measureUnit = SE_PID_UNIT_MK;
542  break;
543  }
544  sprintf(buf, "i%d%d%05d%d%06u%05u%d", pidID, controlOutput, adChannels, measureUnit, targetValue, controlMaxValue, behavior);
545  return SE_Command(buf, usbDevice);
546 }
547 
548 CTYPE int DLL SE_SetPIDconstants(int pidID, int constantId, int constantBase, int constantDivider, int usbDevice)
549 {
550  char buf[128];
551  sprintf(buf, "K%d%d%06u%06u", pidID, constantId, constantBase, constantDivider);
552  return SE_Command(buf, usbDevice);
553 }
554 
555 CTYPE int DLL SE_SetPIDtimeBase(int timeBaseMultiplier, int usbDevice)
556 {
557  char buf[128];
558  sprintf(buf, "s%05u", timeBaseMultiplier);
559  return SE_Command(buf, usbDevice);
560 }
561 
562 CTYPE unsigned short int DLL SE_PIDdata(int pidId, int usbDevice)
563 {
564  char buf[32];
565  const char * ret;
566  sprintf(buf, "j%d", pidId);
567  ret = SE_ReadData(buf, 5, usbDevice);
568  if(ret)
569  return (unsigned short int) atol(ret);
570  return 0;
571 }
572 
573 CTYPE int DLL SE_AuxMotorPositioning(int id, int dir, int steps, int delay, int usbDevice)
574 {
575  char buf[128];
576  sprintf(buf, "}%d%d%05d%05d", id, dir, steps, delay);
577  return SE_Command(buf, usbDevice);
578 }
579 
580 CTYPE int DLL SE_AuxMotorPositCalib(int id, int dir, int steps, int delay, int fcLevel, int usbDevice)
581 {
582  char buf[128];
583  sprintf(buf, "{%d%d%05d%05d%d", id, dir, steps, delay, fcLevel);
584  return SE_Command(buf, usbDevice);
585 }
586 
587 CTYPE int DLL SE_MotorPositioning(int dir0, long steps0, int dir1, long steps1, int usbDevice)
588 {
589  char buf[128];
590  sprintf(buf, "x%d%010u%d%010u", dir0, steps0, dir1, steps1);
591  return SE_Command(buf, usbDevice);
592 }
593 
594 CTYPE int DLL SE_SetMotorSlope(int axis, int slopeIndex, int slope, int usbDevice)
595 {
596  char buf[128];
597  sprintf(buf, "/%d%d%05u", axis, slopeIndex, slope);
598  return SE_Command(buf, usbDevice);
599 }
600 
601 CTYPE int DLL SE_SetMotorSpeed(int axis, int startDelay, int endDelay, int usbDevice)
602 {
603  char buf[128];
604  sprintf(buf, "-%d%03d%03d", axis, startDelay, endDelay);
605  return SE_Command(buf, usbDevice);
606 }
607 
608 CTYPE long DLL SE_ReadMotorCount(int axis, int usbDevice)
609 {
610  char buf[128];
611  sprintf(buf, "X%d", axis);
612  return SE_ReadDataNumber(buf, 10, usbDevice);
613 }
614 
615 CTYPE void DLL SE_MotorCalibrate(int dir0, long steps0, int dir1, long steps1, int bitAxis0, int bitAxis1, int usbDevice)
616 {
617  char buf[128];
618  sprintf(buf, "C%d%010u%d%010u%03d%03d", dir0, steps0, dir1, steps1, bitAxis0, bitAxis1);
619  SE_CommandDeaf(buf, usbDevice);
620 }
621 
622 CTYPE int DLL SE_SetMotorEnable(int axis, int enable, int usbDevice)
623 {
624  char buf[128];
625  sprintf(buf, "m%d%d", axis, enable);
626  return SE_Command(buf, usbDevice);
627 }
628 
629 CTYPE int DLL SE_BridgePulse(int bridge, int activation, int deactivation, int activationWidth, int deactivationWidth, int timeBase, int usbDevice)
630 {
631  char buf[128];
632  sprintf(buf, "B%d%d%d%05d%05d%d", bridge, activation, deactivation, activationWidth, deactivationWidth, timeBase);
633  return SE_Command(buf, usbDevice);
634 }
635 
636 CTYPE int DLL SE_BridgeUntil(int bridge, int activation, int portId, int portBit, int bitTrue, int timeout, int usbDevice)
637 {
638  char buf[128];
639  sprintf(buf, "@%02d%d%d%d%d%05d", bridge, activation, portId, portBit, bitTrue, timeout);
640  return SE_Command(buf, usbDevice);
641 }
642 
643 CTYPE int DLL SE_LinearScanner(int dir, long rows, unsigned short int * outBuffer, int usbDevice)
644 {
645  char buf[128];
646  sprintf(buf, "|%d%06u", dir, rows);
647  return SE_ReadDataBinaryExt(buf, (char *) outBuffer, 5150 * 2 * rows, usbDevice);
648 }
649 
650 CTYPE unsigned int DLL SE_ReadTemperature(int adSource, int muxChan, int average, int usbDevice)
651 {
652  char buf[32];
653  const char * ret;
654  sprintf(buf, "T%d%d%05d", adSource, muxChan, average);
655  ret = SE_ReadData(buf, 6, usbDevice);
656  if(ret)
657  return (unsigned short int) atol(ret);
658  return 0;
659 }
660 
661 CTYPE unsigned int DLL SE_ReadCurrent(int adSource, int highVoltChan, int lowVoltChan, int range, double refResistence, int average, int usbDevice)
662 {
663  char buf[32];
664  const char * ret;
665  sprintf(buf, "O%d%d%d%d%07d%05d", adSource, highVoltChan, lowVoltChan, range, (int) (refResistence * 1000), average);
666  ret = SE_ReadData(buf, 6, usbDevice);
667  if(ret)
668  return (unsigned short int) atol(ret);
669  return 0;
670 }
671 
672 CTYPE long DLL SE_DebugData(int dataId, int param0, int param1, int usbDevice)
673 {
674  char buf[32];
675  const char * ret;
676  sprintf(buf, "!%03d%03d%03d", dataId, param0, param1);
677  ret = SE_ReadData(buf, 6, usbDevice);
678  if(ret)
679  return atol(ret);
680  return 0;
681 }
682 
683 // ****************************************************************************
684 // E X P A N S I O N B O A R D C O N T R O L
685 // ****************************************************************************
686 
687 CTYPE int DLL SE_EspiBusInit(int speed, int usbDevice)
688 {
689  return SE_SetClockSPI(speed, SE_SPI_POL_PHA_00, usbDevice);
690 }
691 
692 CTYPE int DLL SE_EspiRlInit(int board, int usbDevice)
693 {
694  int ret = SE_S_SUCCESS, st;
695  const char bytes[4][3] = { { 0x40, 0x0A, 0xA2 },
696  { 0x40, 0x00, 0x00 },
697  { 0x40, 0x10, 0x00 },
698  { 0x41, 0x00, 0x00 }};
699  // Init MCP23S17 if not initialized
700  const char * rd = SE_ReadWriteSPI(board, 0, 3, bytes[3], usbDevice);
701  st = (int) rd[2];
702  st &= 0xFF;
703  if(st == 0xFF)
704  {
705  ret = SE_WriteSPI(board, 0, 3, bytes[0], usbDevice);
706  ret = SE_WriteSPI(board, 0, 3, bytes[1], usbDevice);
707  ret = SE_WriteSPI(board, 0, 3, bytes[2], usbDevice);
708  }
709  return ret;
710 }
711 
712 CTYPE int DLL SE_EspiOpInit(int board, int usbDevice)
713 {
714  int ret = SE_S_SUCCESS, st;
715  const char bytes[6][3] = { { 0x40, 0x0A, 0xA2 }, // Mode
716  { 0x40, 0x00, 0x00 }, // PA output
717  { 0x40, 0x10, 0x00 }, // PB output
718  { 0x41, 0x00, 0x00 }, // Read IODIRA
719  { 0x40, 0x00, 0xFF }, // PA input
720  { 0x40, 0x10, 0xFF }}; // PB input
721  // Init MCP23S17 if not initialized
722  const char * rd = SE_ReadWriteSPI(board, 0, 3, bytes[3], usbDevice);
723  st = (int) rd[2];
724  st &= 0xFF;
725  if(st == 0xFF)
726  {
727  ret = SE_WriteSPI(board, 0, 3, bytes[0], usbDevice); // Mode
728  ret = SE_WriteSPI(board, 0, 3, bytes[1], usbDevice);
729  ret = SE_WriteSPI(board, 0, 3, bytes[2], usbDevice);
730  ret = SE_WriteSPI(board, 1, 3, bytes[0], usbDevice); // Mode
731  ret = SE_WriteSPI(board, 1, 3, bytes[4], usbDevice);
732  ret = SE_WriteSPI(board, 1, 3, bytes[5], usbDevice);
733  }
734  return ret;
735 }
736 
737 CTYPE int DLL SE_EspiRlWrite(int board, int value, int usbDevice)
738 {
739  int ret;
740  char lb[3] = { 0x40, 0x0A, 0x00 };
741  char hb[3] = { 0x40, 0x1A, 0x00 };
742 
743  lb[2] = value & 0xFF;
744  hb[2] = (value >> 8) & 0xFF;
745 
746  ret = SE_WriteSPI(board, 0, 3, lb, usbDevice);
747  ret = SE_WriteSPI(board, 0, 3, hb, usbDevice);
748  return ret;
749 }
750 
751 CTYPE int DLL SE_EspiOpWrite(int board, int value, int usbDevice)
752 {
753  int ret;
754  char lb[3] = { 0x40, 0x0A, 0x00 };
755  char hb[3] = { 0x40, 0x1A, 0x00 };
756 
757  lb[2] = value & 0xFF;
758  hb[2] = (value >> 8) & 0xFF;
759 
760  ret = SE_WriteSPI(board, 0, 3, lb, usbDevice);
761  ret = SE_WriteSPI(board, 0, 3, hb, usbDevice);
762  return ret;
763 }
764 
765 CTYPE int DLL SE_EspiRlRead(int board, int usbDevice)
766 {
767  char lb[3] = { 0x41, 0x0A, 0x00 };
768  char hb[3] = { 0x41, 0x1A, 0x00 };
769  const char * ret;
770  int retValue;
771 
772  ret = SE_ReadWriteSPI(board, 0, 3, lb, usbDevice);
773  retValue = ret[2];
774  retValue &= 0xFF;
775  ret = SE_ReadWriteSPI(board, 0, 3, hb, usbDevice);
776  retValue |= ((((int) ret[2]) & 0xFF)<< 8);
777  return retValue;
778 }
779 
780 CTYPE int DLL SE_EspiOpOutRead(int board, int usbDevice)
781 {
782  char lb[3] = { 0x41, 0x0A, 0x00 };
783  char hb[3] = { 0x41, 0x1A, 0x00 };
784  const char * ret;
785  int retValue;
786 
787  ret = SE_ReadWriteSPI(board, 0, 3, lb, usbDevice);
788  retValue = ret[2];
789  retValue &= 0xFF;
790  ret = SE_ReadWriteSPI(board, 0, 3, hb, usbDevice);
791  retValue |= ((((int) ret[2]) & 0xFF)<< 8);
792  return retValue;
793 }
794 
795 CTYPE int DLL SE_EspiOpRead(int board, int usbDevice)
796 {
797  char lb[3] = { 0x41, 0x09, 0x00 };
798  char hb[3] = { 0x41, 0x19, 0x00 };
799  const char * ret;
800  int retValue;
801 
802  ret = SE_ReadWriteSPI(board, 1, 3, lb, usbDevice);
803  retValue = ret[2];
804  retValue &= 0xFF;
805  ret = SE_ReadWriteSPI(board, 1, 3, hb, usbDevice);
806  retValue |= ((((int) ret[2]) & 0xFF)<< 8);
807  return retValue;
808 }
809 
810 CTYPE int DLL SE_EspiRlSet(int board, int relay, int ena, int usbDevice)
811 {
812  int sts = SE_EspiRlRead(board, usbDevice);
813  if(ena)
814  sts |= relay;
815  else
816  sts &= (~relay);
817  return SE_EspiRlWrite(board, sts, usbDevice);
818 }
819 
820 CTYPE int DLL SE_EspiOpSet(int board, int opto, int ena, int usbDevice)
821 {
822  int sts = SE_EspiOpOutRead(board, usbDevice);
823  if(ena)
824  sts |= opto;
825  else
826  sts &= (~opto);
827  return SE_EspiOpWrite(board, sts, usbDevice);
828 }
829 
830 CTYPE int DLL SE_LsrDrvSet(int board, double current, int usbDevice)
831 {
832  int v = current / (5.0 / 65536.0);
833  char buf[2];
834  if(v < 0) v = 0;
835  if(v > 65535) v = 65535;
836  buf[1] = v & 0xFF;
837  buf[0] = (v >> 8) & 0xFF;
838  return SE_WriteSPI(board, 0, 2, buf, usbDevice);
839 }
840 
841 CTYPE double DLL SE_LsrDrvGet(int board, int usbDevice)
842 {
843  double V;
844  int v;
845  const char * buf;
846  Sleep(1);
847  // Start a new conversion
848  SE_ReadSPI(board, 1, 3, usbDevice);
849  // Wait EOC
850  do
851  v = SE_CheckSPI(board, 1, usbDevice) & 0x80;
852  while(v != 0);
853  Sleep(250);
854  // Read the data
855  buf = SE_ReadSPI(board, 1, 3, usbDevice);
856  v = ((int) buf[2]) & 0xFF;
857  v |= ((((int) buf[1]) << 8) & 0xFF00);
858  v |= ((((int) buf[0]) << 16) & 0xFF0000);
859  v >>= 5;
860  v &= 0xFFFF;
861  V = v;
862  V *= 0.0000762939453125;
863  V /= 0.1;
864  return V;
865 }
866 
867 CTYPE int DLL SE_WatchDog(int timeout, int usbDevice)
868 {
869  char buf[32];
870  int ena = 0;
871  if(timeout) ena = 1;
872  sprintf(buf, "W%d%08d", ena, timeout);
873  return SE_Command(buf, usbDevice);
874 }
CTYPE int DLL SE_FirmwareRev(int usbDevice)
Check Sestilio firmware revision number.
Definition: sestilio.cpp:327
CTYPE const char DLL_P SE_ReadWriteSPI(int address, int slaveAddress, int num, const char *buffer, int usbDevice)
Write and at the same time read a stream of data from the SPI expansion bus.
Definition: sestilio.cpp:491
CTYPE int DLL SE_SetPIDconstants(int pidID, int constantId, int constantBase, int constantDivider, int usbDevice)
Set some intrinsic PID constants.
Definition: sestilio.cpp:548
CTYPE long DLL SE_ReadDataNumber(const char *command, int rxed, int usbDevice)
Send a command and get it's relative answer as long.
Definition: sestilio.cpp:145
CTYPE int DLL SE_Open(char sestilioId, int usbDevice)
Open the connection with SESTILIO.
Definition: sestilio.cpp:14
CTYPE int DLL SE_FastReadAnalog(int source, int trigger, unsigned period, int samples, int usbDevice)
Start a buffered sampling with one or two A/D converters. Sampled data is stored into RAM 0.
Definition: sestilio.cpp:253
CTYPE int DLL SE_ReadPort(int portAddress, int usbDevice)
Allow to read of the selected port.
Definition: sestilio.cpp:395
CTYPE unsigned int DLL SE_ReadTemperature(int adSource, int muxChan, int average, int usbDevice)
This command enables the realization of an accurate thermometer employing a AD590 sensor to that end.
Definition: sestilio.cpp:650
CTYPE int DLL SE_GetSampleDoubleDataSplit(int source, int address, int num, double *outBuffer0, double *outBuffer1, int usbDevice)
RAM0 and RAM1 are used for sampling data, this command allow to read these devices.
Definition: sestilio.cpp:303
CTYPE int DLL SE_SetPortDirection(int port, int bit7, int bit6, int bit5, int bit4, int bit3, int bit2, int bit1, int bit0, int usbDevice)
Allow to set direction (Input or Output) of the selected port.
Definition: sestilio.cpp:351
CTYPE int DLL SE_BridgePulse(int bridge, int activation, int deactivation, int activationWidth, int deactivationWidth, int timeBase, int usbDevice)
Generate a pulse on the specified bridge.
Definition: sestilio.cpp:629
CTYPE int DLL SE_EspiBusInit(int speed, int usbDevice)
Init the SPI expansion bus.
Definition: sestilio.cpp:687
CTYPE int DLL SE_WatchDog(int timeout, int usbDevice)
Set watchdog.
Definition: sestilio.cpp:867
CTYPE int DLL SE_ClrPortBit(int portAddress, int bit, int usbDevice)
Allow to clear a bit on the selected port.
Definition: sestilio.cpp:384
CTYPE int DLL SE_ReadDataBinaryExt(const char *command, char *outBuf, int rxed, int usbDevice)
Send a command and get it's relative answer to store in a buffer specified as parameter.
Definition: sestilio.cpp:115
CTYPE int DLL SE_SetPID(int pidID, int controlOutput, int adChannels, int measureUnit, int targetValue, int controlMaxValue, int behavior, int usbDevice)
Enable SESTILIO as a temperature controller. Four simultaneous temperature controls are performed at ...
Definition: sestilio.cpp:532
CTYPE int DLL SE_CheckAck(int usbDevice)
Check if an ACK is received from SESTILIO.
Definition: sestilio.cpp:178
CTYPE int DLL SE_SetMotorSpeed(int axis, int startDelay, int endDelay, int usbDevice)
This command effects the speed setting of the motor on the selected axis. The setting adopts an accel...
Definition: sestilio.cpp:601
CTYPE int DLL SE_SetMotorSlope(int axis, int slopeIndex, int slope, int usbDevice)
If the number of steps is sufficient, the setting command realizes an accelerating and decelerating r...
Definition: sestilio.cpp:594
#define SE_PID_UNIT_MF
milli Fahrenheit (AD590 as temperature sensor) not implemented in SESTILIO firmware but at library le...
Definition: sest.h:402
CTYPE int DLL SE_Status(int usbDevice)
Return the status of the last execute operation.
Definition: sestilio.cpp:53
CTYPE int DLL SE_WriteRAM(int source, int address, int num, const char *buffer, int usbDevice)
RAM0 and RAM1 are used for sampling or signal generation, this command allow to write these devices.
Definition: sestilio.cpp:274
CTYPE int DLL SE_EspiRlSet(int board, int relay, int ena, int usbDevice)
Turn on or off a relay on the ESPI-RL board.
Definition: sestilio.cpp:810
CTYPE int DLL SE_FlowReadAnalog(int source, unsigned int num, unsigned short int *outBuffer, int usbDevice)
Maximum speed for A/D sample read. Is a procedure that sample the A/D converter at the maximum speed ...
Definition: sestilio.cpp:260
CTYPE int DLL SE_TransientResponse(int da, int daValue, unsigned period, int samples, int usbDevice)
Perform transient response analysis. Sampling of data is performed with AD0 and AD1,...
Definition: sestilio.cpp:525
CTYPE int DLL SE_AuxMotorPositCalib(int id, int dir, int steps, int delay, int fcLevel, int usbDevice)
Executes a positioning on specified axes in the direction of and by a maximum number of steps to find...
Definition: sestilio.cpp:580
CTYPE long DLL SE_ReadMotorCount(int axis, int usbDevice)
After having launched a setting, it may be necessary to know how much time is needed to complete the ...
Definition: sestilio.cpp:608
#define SE_PID_UNIT_MK
milli Kelvin (AD590 as temperature sensor)
Definition: sest.h:400
#define SE_PID_UNIT_MC
milli Celsius (AD590 as temperature sensor) not implemented in SESTILIO firmware but at library level
Definition: sest.h:401
#define SE_S_RUN
Command running.
Definition: sest.h:257
CTYPE const char DLL_P SE_ReadData(const char *command, int rxed, int usbDevice)
Send a command and get it's relative answer as character string.
Definition: sestilio.cpp:58
CTYPE int DLL SE_PortPulse(int port, int initialValue, int finalValue, int pulseWidth, int timeBase, int usbDevice)
Generate a pulse on the specified port.
Definition: sestilio.cpp:402
CTYPE unsigned DLL SE_Counts(int usbDevice)
Some procedures are long task, with this command is possible to check a countdown to the end of task.
Definition: sestilio.cpp:317
CTYPE int DLL SE_PutSampleData(int source, int address, int num, unsigned short int *outBuffer, int usbDevice)
RAM0 and RAM1 are used for signal generation, this command allow to write these devices.
Definition: sestilio.cpp:281
CTYPE const char DLL_P SE_ReadDataBinary(const char *command, int rxed, int usbDevice)
Send a command and get it's relative answer as a buffer of bytes.
Definition: sestilio.cpp:90
CTYPE int DLL SE_EspiOpWrite(int board, int value, int usbDevice)
Write a value on the ESPI-OP board.
Definition: sestilio.cpp:751
CTYPE const char DLL_P SE_ReadEEPROM(int address, int num, int usbDevice)
SESTILIO have an EEPROM of 128Kbyte for user data, this command allow to read this devices.
Definition: sestilio.cpp:417
CTYPE int DLL SE_WriteEEPROM(int address, int num, const char *buffer, int usbDevice)
SESTILIO have an EEPROM of 128Kbyte for user data, this command allow to write this devices.
Definition: sestilio.cpp:441
CTYPE int DLL SE_EspiOpOutRead(int board, int usbDevice)
Read the status of the opto-coupled output port from the ESPI-OP board.
Definition: sestilio.cpp:780
CTYPE int DLL SE_PwmOptoCoupledPowerPort(int bitSelect, int enable, int lowWidth, int highWidth, int usbDevice)
Start (or stop) a PWM the optically decoupled power port.
Definition: sestilio.cpp:463
CTYPE int DLL SE_WritePort(int portAddress, int portValue, int usbDevice)
Allow to write on the selected port.
Definition: sestilio.cpp:366
CTYPE int DLL SE_SetMux(int chan, int usbDevice)
Select a multiplexer channel.
Definition: sestilio.cpp:202
CTYPE int DLL SE_CPUtemperature(int usbDevice)
Read Sestilio CPU temperature.
Definition: sestilio.cpp:332
CTYPE int DLL SE_LinearScanner(int dir, long rows, unsigned short int *outBuffer, int usbDevice)
With the optional module LINCAM-1 SESTILIO can be used to implement an image scanner....
Definition: sestilio.cpp:643
CTYPE unsigned short int DLL SE_ReadAnalog(int source, int average, int usbDevice)
Start a sampling with a selected A/D converters.
Definition: sestilio.cpp:212
CTYPE int DLL SE_GetSampleData(int source, int address, int num, unsigned short int *outBuffer, int usbDevice)
RAM0 and RAM1 are used for sampling data, this command allow to read these devices.
Definition: sestilio.cpp:286
CTYPE int DLL SE_EspiRlInit(int board, int usbDevice)
Init ESPI-RL board connected on SPI expansion bus.
Definition: sestilio.cpp:692
CTYPE int DLL SE_SetPortBit(int portAddress, int bit, int usbDevice)
Allow to set a bit on the selected port.
Definition: sestilio.cpp:373
CTYPE int DLL SE_ClrCounts(int usbDevice)
Clear the countdown.
Definition: sestilio.cpp:322
CTYPE unsigned int DLL SE_ReadCurrent(int adSource, int highVoltChan, int lowVoltChan, int range, double refResistence, int average, int usbDevice)
This command enables the realization of an accurate ammeter using an external resistance and two A/D ...
Definition: sestilio.cpp:661
CTYPE int DLL SE_AuxPower(int pwrCtrl, int usbDevice)
Turn on/off the power on Y4.16, maximum allowed current is 50mA.
Definition: sestilio.cpp:470
#define SE_S_FAIL
Failed operation.
Definition: sest.h:258
CTYPE int DLL SE_Command(const char *command, int usbDevice)
Send a specified command without any parameters.
Definition: sestilio.cpp:153
CTYPE int DLL SE_SetGain(int chan, int gain, int usbDevice)
Select a gain for specified channel. Gain control is available for group of channels 0-7 and 8-15.
Definition: sestilio.cpp:244
CTYPE int DLL SE_Close(int usbDevice)
Close the connection with SESTILIO. This procedure must be execute at the end of your program.
Definition: sestilio.cpp:38
CTYPE int DLL SE_CheckSPI(int address, int slaveAddress, int usbDevice)
Return the logic level of the MISO line.
Definition: sestilio.cpp:508
CTYPE int DLL SE_SetMotorEnable(int axis, int enable, int usbDevice)
Turn on/off the motor. After a positioning the motor is always on, this can be useful for a great hol...
Definition: sestilio.cpp:622
CTYPE int DLL SE_WriteKPortConfig(int regAdd, int regValue, int usbDevice)
Allow to write a register of the Port Expander (MCP23S17) used for PORT A and B.
Definition: sestilio.cpp:337
CTYPE int DLL SE_SetPIDtimeBase(int timeBaseMultiplier, int usbDevice)
The PID is a preset value and runs a cycle every 100 mS.This command enables modification of before m...
Definition: sestilio.cpp:555
CTYPE int DLL SE_EspiOpSet(int board, int opto, int ena, int usbDevice)
Turn on or off an opto-coupled power output on the ESPI-OP board.
Definition: sestilio.cpp:820
CTYPE int DLL SE_WriteAnalogDual(int val0, int val1, int usbDevice)
Set all DACs to a requested value at the same time.
Definition: sestilio.cpp:230
#define SE_S_SUCCESS
Success.
Definition: sest.h:256
CTYPE unsigned short int DLL SE_PIDdata(int pidId, int usbDevice)
Read the PID data value.
Definition: sestilio.cpp:562
CTYPE int DLL SE_EspiRlRead(int board, int usbDevice)
Read the set relay from the ESPI-RL board.
Definition: sestilio.cpp:765
CTYPE int DLL SE_FastWriteAnalog(int source, int trigger, unsigned period, int samples, int usbDevice)
Is a function generator on one or two DACs at the same time.
Definition: sestilio.cpp:237
CTYPE int DLL SE_ReadKPortConfig(int regAdd, int usbDevice)
Allow to read a register of the Port Expander (MCP23S17) used for PORT A and B.
Definition: sestilio.cpp:344
CTYPE int DLL SE_CheckPortBit(int port, int bit, int usbDevice)
Check a bit of the opto-coupled port.
Definition: sestilio.cpp:409
CTYPE int DLL SE_EspiOpRead(int board, int usbDevice)
Read the opto-coupled input from the ESPI-OP board.
Definition: sestilio.cpp:795
CTYPE int DLL SE_WriteDataBinary(const char *command, const char *buffer, unsigned length, int usbDevice)
Send a specified command and it's buffer of parameters.
Definition: sestilio.cpp:130
CTYPE int DLL SE_EspiRlWrite(int board, int value, int usbDevice)
Write a value on the ESPI-RL board.
Definition: sestilio.cpp:737
CTYPE void DLL SE_CommandDeaf(const char *command, int usbDevice)
Send a specified command without any parameters and without wait ACK from SESTILIO.
Definition: sestilio.cpp:169
CTYPE int DLL SE_GetSampleDoubleData(int source, int address, int num, double *outBuffer, int usbDevice)
RAM0 and RAM1 are used for sampling data, this command allow to read these devices.
Definition: sestilio.cpp:292
CTYPE const char DLL_P SE_ReadSPI(int address, int slaveAddress, int num, int usbDevice)
Read a stream of data from the SPI expansion bus.
Definition: sestilio.cpp:484
CTYPE int DLL SE_AuxMotorPositioning(int id, int dir, int steps, int delay, int usbDevice)
Executes a positioning on specified axes in the direction of and by the specified number of steps....
Definition: sestilio.cpp:573
Sestilio Library Function and Procedures prototypes.
CTYPE int DLL SE_BridgeUntil(int bridge, int activation, int portId, int portBit, int bitTrue, int timeout, int usbDevice)
Activate a specified bridge until a bit on specified port is true or forever.
Definition: sestilio.cpp:636
CTYPE int DLL SE_SetID(char sestilioId, int usbDevice)
Set a new ID for connected SESTILIO. As factory setting the ID is set to '0'.
Definition: sestilio.cpp:194
CTYPE void DLL SE_MotorCalibrate(int dir0, long steps0, int dir1, long steps1, int bitAxis0, int bitAxis1, int usbDevice)
Command allowing calibration of one or more axes at a time. Executes a maximum number of steps until ...
Definition: sestilio.cpp:615
CTYPE double DLL SE_LsrDrvGet(int board, int usbDevice)
Measure the current set on LSR-PWR1 board on ESPI bus.
Definition: sestilio.cpp:841
CTYPE int DLL SE_WriteSPI(int address, int slaveAddress, int num, const char *buffer, int usbDevice)
Write a stream of data on SPI expansion bus.
Definition: sestilio.cpp:477
CTYPE int DLL SE_LsrDrvSet(int board, double current, int usbDevice)
Set the current for LSR-PWR1 board on ESPI bus.
Definition: sestilio.cpp:830
CTYPE unsigned DLL SE_NumOfDevices()
How many SESTILIO are connected?.
Definition: sestilio.cpp:48
CTYPE int DLL SE_EspiOpInit(int board, int usbDevice)
Init ESPI-OP board connected on SPI expansion bus.
Definition: sestilio.cpp:712
CTYPE int DLL SE_WriteAnalog(int chan, int value, int usbDevice)
Set a specified DAC to a requested value.
Definition: sestilio.cpp:223
CTYPE int DLL SE_SetClockSPI(int speed, int mode, int usbDevice)
Set the SPI clock.
Definition: sestilio.cpp:518
CTYPE const char DLL_P SE_ReadRAM(int source, int address, int num, int usbDevice)
RAM0 and RAM1 are used for sampling or signal generation, this command allow to read these devices.
Definition: sestilio.cpp:267
CTYPE int DLL SE_MotorPositioning(int dir0, long steps0, int dir1, long steps1, int usbDevice)
Executes a positioning on two axes in the direction of and by the specified number of steps.
Definition: sestilio.cpp:587