12-14-2009 03:23 AM - edited 12-14-2009 03:28 AM
poethomer wrote:Syntax
SSIDLL_API int __stdcall SetDecodeBuffer(int nComPort, unsigned char *pData, long
max_length);
where:
. nComPort is the COM port number used in the call to SSIConnect
. pData is a pointer to the destination buffer for decode data returned from the
scanner
. max_length is the size in bytes of the destination buffer
If this prototype is correct, the DLL function does NOT return a pointer. Instead it expects to be passed a memory pointer by the calling application, that is presumably supposed to be at least max_length bytes long. There is no other way!
However the name of the function gives reasonable support to the assumption that it is just assigning a string pointer to some internal global variable that the DLL will then fill in AFTER that function has returned. This is a way of operation that is very special and assumes that the buffer that was passed to SetDecodeBuffer() stays valid AFTER the control returns back to LabVIEW from that function.This is not generally the case for LabVIEW variables that reside in a wire. Once a wire stops existing on the diagram, LabVIEW not only reserves the right to reuse its buffer but in general also does so. So you would have to make sure that the wire stays in the diagram without further wire branches until after you can be sure the buffer has been filled and after you have used the aforementioned memory copy function to copy out the now available information from it.
It is uttermost important to not branch the wire on its way to the copy memory function in any way, as this would cause LabVIEW to most likely create a copy of the memory buffer and it would be sheer luck if the original buffer is passed to you copy memory function or the other place you were branching of to.
Remember the second section is entirely based on assumptions because of the function name. What this function really does and how it is supposed to be used should be explained in detail in the according documentation to the DLL. If it isn't, that is a problem of the DLL creator or distributor, not LabVIEW.
12-16-2009 12:18 PM
Hi,
problem is solved using LabVIEW only. I tried using ActiveX Control. So I am bale to get the data from the scanner now.
05-05-2010 04:00 PM
Anil,
Were you able to use the ActiveX Event Callback to get the scanned data? I cannot seem to get the callback to fire. Could you post an example of what you did?
Thanks,
John
05-06-2010 07:42 AM
Hi John,
I could get scanned data using ActivX events. We need to setup few parameters in the scanner before scanning.
connection flow goes like this....
Automation open (point this to ActiveX control)
Set baud rate, COM port number
connect com port
enable scanner (netter to use)
change parameter "decode data packet format" as "Packeted Decode Data"...This will not be selected by default withe the scanner, so you have to set this parameter
set trigger to host trigger mode
then send command to pull trigger
then Use Reg Event Call back node and event "decode data available"
disconnect com port
unregister events
close automation
Let me know if you still have problem...
Regards
Anil
05-06-2010 09:36 AM
Anil
I followed your program flow but I am still not getting the callback vi to execute. I'm at a loss for what the problem is. I've attached my vi and the callback if you could take a look and see if I'm missing something I'd greatly appreciate it.
Thanks,
John
05-06-2010 11:51 AM
few modifications in call back VI...........
remove case structure, feed SSI Code "0" (zero) and event type "8"...This is how I am using now........Lets see if that helps out........
05-06-2010 12:00 PM
05-06-2010 01:49 PM
wow thats great.......I am glad that it solved your problem......
you can improve this by adding event structure in the while loop..
remove all sequence structures
add event structure to while loop....add a STOP button and add event for that.
now bundle these data reference and stop button reference..then feed it to "user parameter" option in "reg event callback".
and in the call back VI, write True to Value (signalling) property of Stop button. Make sure it is Value (signalling) ..not just "value".......
this will make your program exit as soon as decode happens........otherwise you will have to wait for some time to read the data......
09-12-2012 04:18 PM
I have the same problem, im doing the same but my scanner does not retrieve anything. do you could advice.
09-13-2012 04:59 PM
Hi Danaielt,
Could you provide a little more information about your scenario? In order to see if I have any suggestions, I would like to know which one of the listed options you've tried so far. Enjoy the rest of your day.