QUOTE(BobLfoot @ Apr 21 2009, 08:22 AM) [snapback]81316[/snapback]
QUOTE(JohnnyJupiter @ Apr 21 2009, 12:00 AM) [snapback]81301[/snapback]
Greetings to all,
A newbie here. I just got my brandy-new MicroLogix 1100 talking to my laptop, so now I'm on to trying to solve a simple problem as a way of getting familiar with the whole environment. I've been a C/C++/C# Microsoft programmer my entire professional career, but I always wanted to learn to program PLC's...so here I go!
Here's the problem: Measure how much conveyor has passed a given point. I've got a 16 tooth/rev gear mounted on a shaft over which the web passes, with a prox to count pulses. The geometry works out to 1.0427 feet/rev. When the user pushes a button, start measuring. When the user pushes the same button, stop measuring, do the math, and display the number of feet that has passed between the two button pushes.
I think I could count teeth, but the user might wait a couple of hours between button pushes so I'm concerned about overflowing a counter. I estimate it takes 2 - 3 seconds for one revolution of the shaft carrying the gear, so in three hours I could 'see' ~57k pulses.
...and I've got a bunch of questions about using the LCD display, debugging the program on my laptop before deploying, how to wire inputs, ... the list goes on. I've been searching the Web for 15 hours today, got some great but confusing info, figured I'd ask the collective wisdom of the Forum before I spent more inefficient use of time.
Thanks so much for your help; I'd be glad to provide any other info that might be useful.
Best,
JJ
JJ having programmed for years you know it is easier to teach someone by debugging their work than by giving them your solution to a problem. It sounds like you have a good plain english definition of your problem. Why not take a crack at writing the code, DO NOT WORRY ABOUT THE OVERFLOW FOR NOW, and post your first attempt to the forum. WE PROMISE TO BE GENTLE when reviewing it and will propose several solutions to handle the overflow once we see how your problem solving mind works.
BTW -welcome to the forum and thnaks for participating.
Hello BobLfoot,
Thanks for the guidance you offered. Today was enlightening and frustrating at the same time...I learned a ton about using RSLogix Micro Starter Lite, but also realized I have long way to go.
Okay, per your suggestion I wrote a program, got almost all the features I want but almost certainly wacky as far as execution is concerned. Here it is, first is a flow diagram:
[attachmentid=7433][attachmentid=7434]
The second attachment is a PDF of my ladder logic. Rungs 0 and 1 are an attempt to implement a button that remembers if it was pushed per my requirements: first push starts counting, second push stops counting and then does math.
Rung 2 just starts counting pulses, there's going to be a problem with more than 32767 counts but you suggested I ignore that for now...so I did!
Rung 3: I'm starting to fall apart...the intent is to move the counted value into a integer register for some math in the Rung 4, where I do some math.
All rightk, please rip me to shreds!

Here's what I think is wrong so far:
1. I never turn off counting once it's started.
2. I don't display the output on the teeny LCD screen on my ML 1100, but working out the LCD instruction is a job in itself...that's for tomorrow.
3. The counter overflows.
[attachmentid=7435]
Thanks in advance for any suggestions you can provide. My feelings will not be hurt and sorry for being such a dork!
Regards,