Home AMX User Forum NetLinx Studio
Options

Device Mappings - Wow!

For most of my projects, I do not use the Device Mapping feature in Studio. This morning, I happened to notice that in one of my large projects, all of my device mappings indicated 'Invalid Device'. I don't recall this problem until moving to Studio 3.3 and I am now on 3.4 but the problem remains. I checked over the forums and found similar problems and checked the items mentioned in those posts (DEFINE_DEVICE in lower case, #IF_DEFINED used to re-define the same devices, etc.). None of these previously noted corrections were applicable in my case.

I therefore spent time this afternoon editing the file until the device mappings appeared and what I was found was nothing short of amazing (to me anyway!). As it turns out, at the same time I upgraded to Studio 3.3, I had gone through the main program file for this large project and added comments to the DEFINE_DEVICE section. Many of the comments were multi-line using (* and *) for the comment blocks. As it turns out, the use of this comment construct is the problem. In particular, if your comment spans multiple lines (a comment block) using (* and *), you may well have devices following the first of those comment blocks that do not appear in Device Mappings. A single line comment using (* and *) does not create a problem. If you convert all of the multi-line comments to use // instead, the Device Mappings work as they should. In short, if you are having trouble with Device Mappings and you use (* and *) for multi-line comments in your DEFINE_DEVICE section, check it out.

And yes, the module did compile correctly with the (* and *) comment delimeters and the devices (several hundred of them) were correctly defined before converting the multi-line comments to use // instead. The only problem was that the devices did not show up in the Device Mapping dialog. For anyone with Device Mapping issues, add this to the list of things to check.

Comments

  • Options
    a_riot42a_riot42 Posts: 1,624
    The same is true if you use a #warn directive. I had often put those in to remind me to change a device or something and it would make any devices after that no longer show up in the device mapping so they couldn't be mapped. There's definitely some work to do there with the device mapping features and comments or compiler directives. Might be "Monday" code at work.
    Paul
  • Options
    I understand how device mappings could (or should) save time, but because of all the issues, I stopped using them almost day 1. I use the <Custom> device mapping and have done with it.
  • Options
    @nicholasjames, I'm not familiar with the < Custom > device mappings. Would you mind giving more info, or telling me where I can find info. I don't see anything showing up in PI or studio help. I noticed there was something in the device mapping, but it doesn't seem to apply in this case.
    Thanks in advance.
  • Options
    chillchill Posts: 186
    Off topic question
    ...snip... the devices (several hundred of them) were correctly defined ...snip...

    I do have to wonder: what kind of system needs several hundred devices? That seems excessive.

    Unless you're using multiple touchpanels and modules with dozens of D:P:S each, the utility of which practice escapes me, but I know that's what they teach these days.
    .
  • Options
    CIAJesse wrote: »
    @nicholasjames, I'm not familiar with the < Custom > device mappings. Would you mind giving more info, or telling me where I can find info. I don't see anything showing up in PI or studio help. I noticed there was something in the device mapping, but it doesn't seem to apply in this case.
    Thanks in advance.

    Sure! If you look at the right hand side of the device mapping window where all the defined devices are listed, the very top entry is "<Custom>.........User-Defined". Punch in the D:P:S and you're set. This is now "hard-coded" into your workspace so if your device changes you'll have to remember to change the D:P:S yourself, but no more problems with auto-mapped devices dissappearing.

Sign In or Register to comment.