SNAP B3000 ENET Ethernet IO C++ Programming Code Problem

Dear Sir:

  I am new to the OPTO22 system and I am evaluating your product on behalf of my company.   My problem is that I can't designate "module zero - point zero" to be a designated output port.    I am using a SNAP B3000 ENET brain that is mounted on the SNAP B8MC printed circuit board.   My code can compile, however, my port never becomes a designated output port.    This condition is observed in the IO manager program.

   The IO manager program tell me that that "module zero - point zero" is located on a 12 digit hex address, however, all the functions in the OPTOMMP protocol guide are 8 hex digit LONG addresses.    I have uploaded the OPTOMMP protocol guide for your convenience.   Please go to page 153, I suspect that my unit is deemed an older unit and these are the addresses that I am assigned.    

    The particular program I am modifying is the "digital bank" program that one can download in the OPTO SDK kit entitled, "SNAPEnetDTK_R20a.exe".   

     Can someone please open up the driver kit and send me the C++ codes to insert into the "digital bank"  program so that I can designate "module zero point zero" to be a designated output port? 

     There is absolutely no explicit code that tells one how to accomplish this specific task.  However, this task is possible because the program IO manager can designate points to be output ports.    Please send me the code as contained in the digital bank program so that the system is operational - the addresses of the module/points can be found on page 153 of the OPTOMMP manual that I have uploaded.      This is the link to the SNAPEnetTDK_R20a software development kit.

The digital bank C++ file is found in the “Examples” folder. All that needs to be done is just download and install the files, open the folder, and insert the code.

Thank you for your time.

For some reason the link that I posted did not go to the webpage that I was on when I was looking for the SDK. I am reposting the link to be certain that you can get to it:

Hello EIO,

Welcome to the OptoForums!

You have the correct manual (form 1465), just check out page 78 or search for [B]ConfigurePoint[/B] to find the options for commands to configure the point. After the OpenEnet command, you’ll need to send a command to configure your outputs (digital/discrete points are inputs by default). The instruction might look something like this:

nResult = m_Brain.ConfigurePoint(0, 384); // 384 = 0x180 (output)

For that specific example, you might add that after the connection to the hardware is open, around line 186 of the DigitalBankDlg.cpp file.

That hex value of 0x180 what you see on the page 153 you mentioned. You do NOT need to know the memory map address (for example, F0C0 0004 like you see on page 153) because the ConfigurePoint command handles that for you based on the point number passed.

I hope that helps!


Dear OptoMary;

 I would like to thank you for your efforts.   It is the thought that counts.

 When you wrote:

“around line 186 of the DigitalBankDlg.cpp file”

 I inserted some code there prior to your response (about a week ago) and this ended up causing the system to become inoperable.   

 This is why I left so much documentation and the download link to the development kit.    I felt that a programmer with prior experience with this unit would have a working answer and could write a couple lines of working code to get me started.     I know that opto sells a lot of different models, therefore, there probably isn't someone at the company who can program every unit.   But, I did think that I could get lucky and, maybe, someone may be able to reply with working code.   

 Believe it or not, your answer was probably one of the better replies that I had received - as compared to some of the official technical support replies that I had read.    As of this date, I have received no coded working replies from the official technical support personnel.   Emailing just a link to a manual is often really not very helpful, especially in the case where the directions in the manual substancially differs from the actual code that has to be utilized to get a unit up and running.   

 I am very, very, grateful that you have pointed this out for me.   

 Hopefully, someone who has prior experience with this particular model will reply.

 By the way, when you wrote:

" ConfigurePoint command handles that for you based on the point number passed"

 Can you tell me what prior coded instructions have to be inserted before the "ConfigurePoint" command?   I am under the belief that the "brain" has to know at a minimum, the module number and the point number, to reference an address?  

 Again, I want you to know before I log off, that I am very, very, grateful to receive the information that you have passed onto me.   The problem is how can one detect when the information in the manual will differ from what is required to be written in code to get a unit "up and running."   This is why I really need working code.   

 Hopefully, someone will reply.   If you are employed by OPTO22, can you please ask someone to write me some code just to get me started?   This would be appreciated.  But with my luck it probably isn't the case that you are employed by OPTO22.  

 Either way, I am going to keep experimenting tonight.  Hopefully, I will get lucky.

Hello EIO,

Part of the confusion you’re running into (and why there are various commands to do the same function) is because in that older product, we had a maximum of 4 points supported on a rack. The points on the whole rack were numbered 0-63. So, to answer your question about module numbers, you’d use that to calculate your 0-63 point number (point = point on rack + (module number x 4)).

But let me take a step back here, as I try to sort through your attempts to use this legacy hardware and older SDK. In your first post, you mention that you’re “evaluating” product here, which leads me to believe you do NOT have an existing working system, is this correct?

As it states on our website for that SNAP-B3000-ENET part here:
"this is a legacy product and not recommended for new designs. For new designs, the SNAP-PAC-EB1 brain is more powerful and costs less."

Can you tell me why you’ve chosen this older product, with few features, and a higher price tag to use here?


Dear OptoMary;

  Thank you for your reply!!!

   My company, Integrated Wireless Technologies, services hundreds of existing, working,  OPTO22 systems.    However, the branch that services these systems is located east of the location where I work - on another site.    About a couple of weeks ago, one of the owners of the company placed the SNAP-B3000-ENET on my desk and said he needed a unit "up and running" and wanted me to create a program to operate the unit.  

    Before this point in time I had never worked with an OPTO22 system.    In the past, the OPTO22 units were installed and maintained by the branch located east of us but due to personnel changes, we now have to shoulder this responsibility.    We are now evaluating your system.

     Today I took a look at your software PAC project 9.3 and I now I know why there was confusion.   The numbering system is different with regard to how ioManager defines points and modules and how the 9.3 software bundle defines points and modules.    

      This is why I like unredacted hexadecimal numerical addressing system (absolute definitions leave no room for interpretation).  Layers and layers of code and differences between how different software interprets data leads to confusion.   This is a good example of confusion.   But we are confused no longer.  

      This is why I wanted a person who had experience programming this unit to please send me some code written in C++ using the "Digital Bank" example found in the SDK which I had uploaded.    I still want the code so I will have a programming platform to operate with.  

       The reason why I used the SDK is because it was sent to me by OPTO22 technical support personnel.  That is the only reason why this software was chosen.    

        Now that we know that there are, at least, two different addressing methods, the only resolution to my situation is working code.   If you believe that the equation you had offered me will work for my situation, then please send me a code snippet inserted into the program and I will try it.  
        If you would like to defer and ask someone who has programmed this unit in the past using C++ I would also appreciate that solution.  

     Either way, I appreciate your informational replies and you are so far, one of the best persons that I have come in contact with since I was introduced to the OPTO22 system.    Some technical support staff personnel at OPTO will either ignore a question they can't answer, or send you a link to a manual (which is pretty useless most of the time because if the answer were in the manual, you wouldn't be writing to technical support in the first place).    

      I just happened to have gotten very lucky today.   I was in my office with the owner of the company and he was looking over your PAC Project software (9.3) and we both noticed that the IO manager and the PAC 9.3 software used different numbering systems.     When you had described your equation, I got an inkling of what was transpiring.     The only way we can resolve our issue is by some code snippets.   In the alternative, since IOManager is probably obsolete software now, hopefully, you can send me the source code for this program.   This is another solution.   I know that the numbering and/or coding system may be deemed obsolete by your standards, but, I don't care I just want to run something that works.   I don't care what method, or what form, or what interpretations are made in the code, or even how complex or cumbersome the coding scheme is -  I just want something that works.    Hopefully, someone can chime in and resolve this situation.

Does it have to be C++? Because while I’ve used and altered that exact example in the past (and so have some of my coworkers in product support), we no longer have those tools loaded on our more modern operating systems. Most customers are looking for .NET support with our PAC products. If you’d asked us about that, say, 10 years ago it wouldn’t have been such a problem.

Also, I’d still like to know the big picture of what you’re trying to build, and why you’ve chosen to use C++ with that SNAP-B3000-ENET. You could use a PAC (even SoftPAC, which runs on a PC) and our easy-to-use flow-chart based PAC Project software which you mentioned. This software can communicate to your SNAP-B3000-ENET (and all the others on the same network) without you having to worry about compilers or linking errors or addressing schemes. I’d strongly recommend you consider a solution like that vs. trying to roll-your-own software.

I’d be interested in knowing what other Opto 22 hardware you have in the system. Do you know if all the other Ethernet hardware is on the same network? If so, you could use PAC Manager (which is part of PAC Project, the modern equivalent of the IOManager you mentioned), to “find” all the Ethernet devices on the same network. Just choose Tools > Find Opto MMP Devices then click the “Find” button.

The fact that you have IO Manager and PAC Project makes me think you might already have an Ultimate I/O unit, or a PAC. Using either/both of those with the PAC Project programming software would be a much better way to go than trying to write your own software.


Dear Mary;

  I am just the person who was given this assignment, that is all.   The company is in the early stages of "migration" and product evaluation.    The people at the top make their decisions based upon their own observations and the feedback that I tell them.   I believe that someone at the top could be reading this thread and making an evaluation right now.    However, I can't be certain of this.    All I know is, I can't answer your questions with regard to what other products are in the field because I am not working at the field location, located east of my location.    I was given a device and told to make it work.   That is what I am trying to do.    The development package utilizes C++, therefore, I utilize C++.    I don't know why some of the questions you posed went in the direction that they did.    I am clueless.   However, it not necessary for you to explain yourself.    I don't want you to do that.   Your information is somewhat helpful and that is all that is relevant.     I am only trying to complete the "task at hand," that is all.

  I went to this forum because it is entitled, "code samples and tips."   I thought that I could get some code samples and tips at this forum.   I can only hope that someone kept some notes since you mentioned that the product was in full C++ support ten years ago.   I would think that someone did because ten years ago is not that long ago in terms of product life and new units are still being sold.    Also, company personnel generally keep records, especially the people who actually had to write the code.    I am actually very surprised that no one can answer this question.   

   If the need arises for me to sample the other software that the company has to offer, I will.   I will start another thread if that need arises.    This thread is entitled, "SNAP B3000 ENET Ethernet IO C++ Programming Code Problem."    The C++ code is the current need that needs to be fulfilled.   I can only hope that someone will fulfill this need.

I understand from our product support team that they’ve confirmed that either the command I mentioned above or the command after that (SetDigPtConfiguration) in the manual you mentioned both work fine in the location in the code I suggested. (The second one has the additional “feature” parameter if you need that too.)

I will have our docs team clarify the question you had about point vs. module number. Thank you for pointing that out.

BTW, if you need additional help with developing your custom software, we have a number of experienced OptoPartners who would be happy to help. Here’s link to that list:

Dear Mary,

 Thank you for your reply.  

 It is unnecessary to reply with regard to clarifying our discussion of point and module numbers, I realize that points alone can be unique identifiers and that is all that is required to make code work.    

 I would like to thank you for your efforts, they are appreciated.     I have read some working SDK code and I believe the task of setting a digital point to an output point is not as simple as one would expect.   The working code that is the compatible for the old unit does some parsing of data.

 I wrote a program in another environment using third party software that can accomplish my tasks.  However, I find my "workaround" to be very "kludgy" and I would like to develop my code the proper way working within the C++ environment.    Therefore, I am still looking forward to proper fix for this problem.     

  I actually looked over the list about a week ago with someone from tech support.   There was no one located near my location in NY.    It would be more economical for the company to just purchase a later version of the "opto" brain unit.    It is possible that they may move in that direction.   The problem that I am running into is quite common in the tech world, old hardware and new software, just not getting along .

  Hopefully, some old code snippets might just save the day.

Dear Mary;

 Tech support sent me some code and I am a happy camper!

  I focussed upon code that worked, therefore, I was looking at the console programs that parsed the user data inputs.   These programs worked based upon hex number data inputs. 

  The actual solution had nothing to do with the parsing of data (which I thought would have to take place because of the different addressing between old and new units).   

  The solution had to do with the interpretation of the code.  I was thinking in term of hex addresses and hex digits based upon the function prototype information and the data inputs for the working console programs.  This interpretation is also in line with common microcontroller kit or DSP programming.   The OPTO22 working code is a simple function that interprets its data inputs in base 10 point numbers.    

   It would have been nice if the authors of the MMP protocol guide had offered the reader enumerated examples.

    I am going to insert the code snippet tomorrow at work.  

    Problem solved.

    Thank you for your help.  It was appreciated.

Dear Mary;

I just received the code snippet in my email and I am a very happy camper.

I read the working console programs in the SDK and they used hex digit addresses to get the unit to function as planned.

The console programs parsed user data inputs. This was not the case in the digital bank example.

The solution was in the interpretation of the SetDigPtConfiguration() command. The inputs to the function refer to what appear to be base 10 points (0 to 63) and a hex number to set the point to a digital output (0x180). Since the working console code utilized hex addresses, and most programming utilizes hex addresses, I followed this mode of programming. I believe the point equation that you suggested in an earlier post applies to other OPTO22 units.

It would have been nice if the authors of the MMP document set forth an enumerated example to accomplish this task. Working examples leave no room for interpretation.

I have yet to actually write the code and see it work because the unit is at my job site right now and I am at my house writing to you right now. But, I believe, this is the working solution.

I would like to thank you for your feedback, it was appreciated.