MrPLC Member
  • Content count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About popquiz

  • Rank

Profile Information

  • Country United States
  1. Simple Click For Loop

    Thank you for the replies and the elegant code.  
  2. Simple Click For Loop

    To populate the first eight DS registers, I might use a For loop.  In python it would look like: DS = {} index = range(1,9) for i in index:   DS = i print(DS)  {DS1:1, DS2:2, ... DS8:8} To accomplish the same with a 'Click' For loop, I need to be able to use indirect addressing in the result field of the Math instruction.  For ex: If I could replace DS1 with DS[DS9] below, then the python loop and the Click loop would be functionaly equivalent.  Without this capability, I don't see a concise way of going about this.  Any ideas?  
  3. Recently, my youngest caught a nasty bug that was going around, so I took him to the doctor’s office. His comprehensive battery of questions suggested a curiosity about pretty much everything in the examining room. My final answer was, “If you study really hard, you can become a doctor someday.” To which he immediately responded, to my extreme satisfaction, “No, I want to be an engineer; I want to build things.” From your posts, it appears that the general consensus is: The goal is to add value - which suggests that manufacturing is not essential. But my uneasy concern for the manufacturing sector was ratcheted up after this exchange with my son. Will there be anything for him to build? Anyway, I offer two links which consider the effects of the last recession on the manufacturing sector. The first article was written by the PhD that wrote my Inter. Macro Economics text. My directional school Professor descibed him as a “superstar.” But, when he wrote this article, he was in the Bush administration and was paid to put a positive spin on things. It was a great text book and a bestseller. I can’t vouch for the other link but it is definitely a counterpoint. http://www.economics.harvard.edu/files/fac.../40_mfgtalk.pdf http://www.epi.org/publications/entry/briefingpapers_bp149/ I work for a manufacturing facility which was founded at the turn of the century by a blacksmith – we've got some cool toys, but our overall aproach, I suspect, is not state of the art. I don’t want to wait 4 years for the academics to study and explain the effects of the current recession on the manufacturing sector. I’d be very pleased to here from someone like a service rep, or a vendor who travels a lot, or someone who works in a state of the art facility. How is the manufacturing sector doing, over the long run? And can the U.S. pay its bills (thrive) without one?
  4. Thank you for your very informative answer, Ken. To answer Peter, by my reckoning, if the gadgets employed by the U.S. controls industry are not manufactured in the U.S., then the U.S. controls industry, as a whole, merely provides a service to the manufacturing sector. Sure, competition within the U.S. controls industry to provide these services advances technology; and since technology is one of the four factors of production, i.e., labor, capital, resources and technology, overall productivity gets a boost and this generally increases the wealth of a nation. But the link is not direct. And of coarse everything gets tangled up when you factor in globalization. Like in the case of an American firm using foreign made hardware to provide a solution to a foreign or domestic manufacturing facility located overseas. How does such a transaction benefit the U.S. economy in the long run? Underlying all of this, is two decades worth of frustration with fed chairmen, treasury secretaries and economic advisers resigned to the migration of manufacturing overseas. In the 80's there was a resolve. And this resolve led to PLC's, robots and a rush of American students into engineering schools. We are racking up quite a bill for our grandchildren to repay. The agenda in Washington is vast and varied but not much is mentioned about manufacturing beyond wind turbines supplying power to electric vehicles. I'm not advocating bailouts or protectionism, I'm pretty sure free markets and 'creative destruction' are good things; but tax laws should be changed to incentivize domestic manufacturing, some of the many dollars being spent should be directed towards technical education and R&D geared to benefit American manufacturing. It should be easier for an engineering major to get a loan for their education than a politcal science major, and their interest rate should be lower as well. Really, I just wanted to know if there were any PLC's manufactured in the U.S.A. But now that the coarse has veered, I'd be very interested to hear what people think about the state of American manufacturing and the importance of the manufacturing sector to the overall economy.
  5. I just read that some economists consider the manufacturing sector as the wealth producing sector of the economy and the sevice sector as the wealth consuming sector of the economy. Hmmm. Are Allen Bradley PLC's manufactured in the U.S.A.? Are any PLC's manufactured in the U.S.A.? And I don't mean assembled in the U.S.A.
  6. Math question !

    Peter, are you referring to a MSB, divide and conquer, algorithm? If you are, then I found a pretty good link which provides the method in C#. If not, please advise. Thank you. http://www.answers.com/topic/most-significant-bit
  7. Math question !

    This is an interesting question in the general sense. And in the general sense isn't the solution just an iterated bit shift right, easily adapted to most plcs, as in the following C# example: using System; class BitLocator { public static void Main(string[] args) { double TWO = 2; double exponent = 0; int value = 0; int locOfBit = 0; //get integer value do { Console.WriteLine("Enter an integer 0 thru 15: "); exponent = Math.Round(double.Parse(Console.ReadLine())); } while (exponent < 0 || exponent > 15); value = (int)(Math.Pow(TWO, exponent)); //get location of bit while (value != 0) { value = value >> 1; //bit shift right locOfBit++; Console.WriteLine(value); } //send the result somewhere Console.WriteLine("The location of the bit is {0}", locOfBit); } }
  8. Oh that's right. I wired up and ran the code in post #4 a few days ago. It didn't work before I changed STR to STRPD. I'll edit my previous posts. Thanks again.
  9. I see. So the final answer is: STRPD X7 LD K20 XOR V40500 OUT V40500 And if I wanted to toggle all the odd outputs Y0 thru Y15: STRPD X0 LD KAAAA XOR V40500 OUT V40500 And if I replace X0 with a sequence of T0 accumulated values, I'd have a DRUM. I think we're going to have some fancy Christmas decorations this year! Thank you bcarlton
  10. I did go to Allen Bradley's PLC2 school once upon a time. I've searched the web and most toggle logic requires 7 instructions. Of coarse there is the IBox (PONOFF), but really, how many layers of abstraction do we need? I came up with: STRPD X0 LD K1 SUB V40500 OUT V40500 ->but this means you can ONLY use output Y0. I suppose you could use some internal word from some remote quadrant of the control relay bit map in place of V40500 and then slave any real world output you like, but now your code contains 6 instructions. 6 < 7, but I seek 4.
  11. I have a busy DL05 application with available ladder memory limited to just four more instructions, five including the "END" instruction. I need to toggle Y5 on and off with one remaining unused input. Any suggestions?