Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

DigInOut.m 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. % Author & Date: Hyrum L. Sessions 14 Sept 2009
  2. % Copyright: Blackrock Microsystems
  3. % Workfile: DigInOut.m
  4. % Purpose: Read serial data from the NSP and compare with a
  5. % predefined value. If it is the same, generate a
  6. % pulse on dout4
  7. % This script will read data from the NSP for a period of 30 seconds. It
  8. % is waiting for a character 'd' on the Serial I/O port of the NSP. If
  9. % received it will generate a 10ms pulse on Digital Output 4
  10. % initialize
  11. close all;
  12. clear variables;
  13. run_time = 30; % run for time
  14. value = 100; % value to look for (100 = d)
  15. channel_in = 152; % serial port = channel 152, digital = 151
  16. channel_out = 156; % dout 1 = 153, 2 = 154, 3 = 155, 4 = 156
  17. t_col = tic; % collection time
  18. cbmex('open'); % open library
  19. cbmex('trialconfig',1); % start library collecting data
  20. start = tic();
  21. while (run_time > toc(t_col))
  22. pause(0.05); % check every 50ms
  23. t_test = toc(t_col);
  24. spike_data = cbmex('trialdata', 1); % read data
  25. found = (value == spike_data{channel_in, 3});
  26. if (0 ~= sum(found))
  27. cbmex('digitalout', channel_out, 1);
  28. pause(0.01);
  29. cbmex('digitalout', channel_out, 0);
  30. end
  31. end
  32. % close the app
  33. cbmex('close');