Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
jamesbutler01

Junior Member
Registered:
Posts: 7
Reply with quote  #1 
I'm trying to set up the latest monkeylogic on a new PC and have run into a strange configuration problem. When I'm trying to choose my digital output channels for the eventmarker() function, the MonkeyLogic menu is missing a particular line for a certain channel. Here is the picture of the options it gives me:

ml.png 
Which as you can see only has Lines 0:2, 4:7, so line 3 is missing. When I check the DAQ card myself from Matlab, I get this output:

matlab.png  Showing that line3 does exist. Can anyone tell me the reason for the mismatch? I've tried using the system with lines 0:2, 4:7, but when I iterate from eventmarker(0) to eventmarker(255) I get the following eventcodes on my recording system showing that something is definitely wrong:

Capture.png 


0
Jaewon

Administrator
Registered:
Posts: 708
Reply with quote  #2 
NIMH ML does not show the channels/lines already assigned so that you may not assign the same channel/line multiple times. I don't see all your DAQ assignments in the figure. Please check whether the line is already used for Button or TTL. If the line is not used anywhere, your cfg file might get corrupted. Then please delete the *_cfg2.mat file and re-configure.

The rest of your test result is normal. You assigned only 7 lines ([0 1 2 4 5 6 7]) to Behavioral Codes, so the maximum number you can send out is 127 and the output starts from 0 again after that. NIMH ML does not make an error, even if the code is larger than the maximum number it can handle. It just ignores the digits exceeding the maximum. I hope this answers your question.

0
jamesbutler01

Junior Member
Registered:
Posts: 7
Reply with quote  #3 
Thanks, this fixed the problem perfectly.

Just to clarify, when you say ML 'ignores the digits exceeding the maximum', do you mean it sends the remainder of your code divided by the maximum codes available? I.e.:

code_sent = eventcode % maximum_eventcodes  # % = modulus

Hence why the codes loop back from 0 when you go over the maximum?
0
Jaewon

Administrator
Registered:
Posts: 708
Reply with quote  #4 
Yes, it is like the modulus operation, although NIMH ML does not do the calculation.

Try mod(0:255,128) on the MATLAB command window. It is obvious that the codes repeat from 0 when they become bigger than the maximum possible number. FYI, the following code simulates what happened in your system.

>> code = 0:255;          % require 8 bits
>> sent = mod(code,128);  % only 7 bits are available, so the most significant bit will be missing
>> received = floor(sent/8)*16 + mod(sent,8);  % 8 bits, but the 5th-8th bits are actually the 4th-7th bits of the sent codes and the 4th bit is missing
>> plot(received)

0
jamesbutler01

Junior Member
Registered:
Posts: 7
Reply with quote  #5 
yep got it, thanks for the help!
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.