Author Topic: Unused Local Variable 'TNS' & 'TNSLowByte' in SLCMicro Driver  (Read 1980 times)

AabeckControls

  • Full Member
  • ***
  • Posts: 193
    • View Profile
Installed the new HMI computer in the line today, only had a couple bugs I had to fix, but then when I did a rebuild I got 2 errors: 
Unused Local Variable "TNS" in SLCMicro driver.
Unused Local Variable "TNSLowByte" in SLCMicro driver.

The other thing I noticed, the screens load quickly (after the first load) but sometimes take up to 10 seconds to show the status of the PLC, and sometimes clicking on something takes a few seconds to get a reply after the screen has been loaded too.

To speed up the comm's I un-remarked the line & set it to &H5B for a SLC5/04 as suggested, and set all DF1 drivers to 19200 baud from the default 'Auto' so it doesn't look around first. I didn't change anything else in the SLCMicro driver other than that one line.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Unused Local Variable 'TNS' & 'TNSLowByte' in SLCMicro Driver
« Reply #1 on: July 13, 2015, 02:16:41 PM »
Those 2 warnings you are getting because you un-commented the line and these variables are declared below that line and don't get used since the function exits at the un-commented line.

What I do is to comment out all the lines below the un-commented one, and before "End Function". When doing so, I use 2 apostrophes to distinguish between what I comment out and what was already commented out. This way if I need to reverse back I just look for the lines that begin with 2 punctuation marks.
« Last Edit: July 13, 2015, 02:22:32 PM by Godra »

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Unused Local Variable 'TNS' & 'TNSLowByte' in SLCMicro Driver
« Reply #2 on: July 14, 2015, 02:52:06 PM »
Don't forget that the change you made in the driver was applicable to this project.

Your driver will remain locked to 5/04 and if in the future you are to use the same driver with a different PLC then undo the change (or set the code to that particular PLC).

AabeckControls

  • Full Member
  • ***
  • Posts: 193
    • View Profile
Re: Unused Local Variable 'TNS' & 'TNSLowByte' in SLCMicro Driver
« Reply #3 on: July 14, 2015, 07:12:10 PM »
Godra,

I only made that change to the project in this project folder - didn't change anything in my original AdvancedHMI folder as downloaded.  Will only make this change as applicable to the project.