News:

  • June 09, 2026, 12:20:13 PM

Login with username, password and session length

Author Topic: I'm probably doing this wrong...  (Read 17246 times)

MichaelL65

  • Jr. Member
  • **
  • Posts: 19
I'm probably doing this wrong...
« on: January 22, 2009, 12:34:17 PM »
And I'm also sure the information I need is in the manual (which I have read but not fully comprehended yet - when is the CTRIO for Dummies book coming out?  ???), but I haven't been able to find what I need.

I'm working on an update for a system I programmed a couple years ago. The system is on a vehicle (farm equipment, actually), and I use an encoder to tell me how far I have moved. I need things to happen at given locations, so I used the CTRIO Workbench to set the outputs of the CTRIO in "Discreet on Ch1/Fn1" mode and set single presets for a quarter second pulse at certain locations. Then the PLC just looked at those output memory locations to know when to act. That worked great for the last couple of years as there were no changes needed to the presets. Now the customer wants new features that will require these to be dynamic.

I see lots of information on how to change preset tables, but I'm only using single presets. Creating a table to do this seems a bit complex compared to changing a single word. Is there a memory location where I can just write the new value? I can't seem to find it on the memory map (unless it is called something else, which I'm not connecting to what I want).

So, am I trying to go about this the wrong way and need to just do this all with tables or did I miss something simple again?

MikeS

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 264
    • Host Engineering, Inc.
Re: I'm probably doing this wrong...
« Reply #1 on: January 22, 2009, 03:33:22 PM »
if you're not already using them, ctrio iboxes constitute the 'ctrio for dummies', they make it pretty simple to deal with the ladder logic required for interacting with the ctrio.

that said, you can use the Initialize Preset Table function (CTRINPT IBox) to easily create a one entry preset table on the fly. there's also a function called Initialize Table on Reset (CTRINTR IBox) that will create the new table each time the CTRIO input is reset.
Good design costs a lot. Bad design costs even more.

MichaelL65

  • Jr. Member
  • **
  • Posts: 19
Re: I'm probably doing this wrong...
« Reply #2 on: January 26, 2009, 05:34:19 PM »
That seems to do the trick! 8) Took a bit for me to get it figured out as I was making changes while the PLC was in Run mode, and apparently there needs to be a full-stop in order to reset something along the way. But yes, this did what I needed.

Thanks!

MichaelL65

  • Jr. Member
  • **
  • Posts: 19
Re: I'm probably doing this wrong...
« Reply #3 on: January 28, 2009, 12:29:04 PM »
After pulling out some hair I made a couple of discoveries that might be important to note.

First, it will trigger the output when you call the IBox. At least it seems to do that consistently in my system.

Second, the number you set for the preset must match the SCALED value if that is set in the CTRIO (and of course match the number type - real, bcd, etc.). You might want to add that bit of information to future documentation as I cannot find anything regarding that, and it took me several hours to realize that was exactly why it stopped working. :-\

Also, I do not see the outputs of the CTRIO actually light. The PLC program reads the output bit in the ladder logic for my application, so it isn't a real big issue other than for troubleshooting (which was part of why it took me so long to find the problem). I know they lit when I had entered the set point through the CTRIO Workbench instead of the PLC program. Do I need to set something for that to happen? I couldn't find anything in Workbench.

Greg

  • HostTech
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 702
  • Hmmm...
    • Host Engineering, Inc.
Re: I'm probably doing this wrong...
« Reply #4 on: February 04, 2009, 04:15:11 PM »
You wrote, "First, it will trigger the output when you call the IBox."

This shouldn't happen unless there is a Preset of 0 to fire the Output in the table you create. But to fully understand that I'd have to see your code. If you want me to look at it for you, zip up your project (and CTRIO .CWB file) and e-mail to support@hosteng.com, ATTN: Greg.


You wrote, "Second, the number you set for the preset must match the SCALED value if that is set in the CTRIO (and of course match the number type - real, bcd, etc.). You might want to add that bit of information to future documentation as I cannot find anything regarding that, and it took me several hours to realize that was exactly why it stopped working."

True, and duly noted. If you create manual Preset Tables you can select whether you want your Preset value to be Raw or Scaled. But if you are creating them on the fly, I guess we just had to pick one or the other, and since the input was scaled, that made the most sense.


You wrote, "Also, I do not see the outputs of the CTRIO actually light. The PLC program reads the output bit in the ladder logic for my application, so it isn't a real big issue other than for troubleshooting (which was part of why it took me so long to find the problem). I know they lit when I had entered the set point through the CTRIO Workbench instead of the PLC program. Do I need to set something for that to happen? I couldn't find anything in Workbench."

There is definitely nothing to set in CTRIO Workbench to make the light happen... it should most definitely light when the Output is fired, especially since you said you are firing a 0.25s pulse (that's really long in digital world!). AFAIK it is hardware that does this. So, what is the voltage you are using on the CTRIO, and how do you have the Output hooked up? Otherwise, I'll have to test this myself here in the lab and see if the light depends on whether you are using a preconfigured Preset Table or an On-the-Fly Preset Table. Hmmm...  ???
There are two types of people in the world; those that can extrapolate from incomplete data sets.