Convert Allen Bradley Logix 5000 Time to Unix Time (Epoch)

My favorite time format for time stamping events is to use Unix Time.  The AB Logix 5000 controllers offer time in a format that is similar, but requires some conversion.  Here is code for a RedLion device that does that conversion.

Screenshot from 2016-07-28 17:24:19

Continue reading

Posted in Industrial Automation | Tagged , , , , , , , | Leave a comment

Convert Unsigned Integer to Float

I’m working with a RedLion device that treats integers as signed, and they don’t provide the function needed to convert an unsigned integer into a floating point.   Here is some code that will treat the 32 bit register as an unsigned integer and convert it to a double precision float.

Screenshot from 2016-07-28 14:40:53

//convert 32 bit unsigned integer to a float (returned as a string)
// Sparky Geek, LLC July 2016

// in signed integers, negative numbers are represented by the two's complement of the absolute value
// the task for this program is to undo this situation (just ignore the two's complement format)
// check to see of the MSB (AKA 'sign bit') is set 
// --- if it is, mask the MSB, read as a signed number, then add 2^31

int working;
cstring result;
int mask = 2147483647; //2^31-1, or 1 zero followed by 31 ones

if (uint_in < 0 ) // check to see if MSB is set
 working = uint_in & mask; //bitwise AND to only pay attention to the least significant 31 bits, filter out MSB
 IntToR64(tmp.TagA[0],working); //have to use tag, since we can't create a local array, convert to double precision float
 TextToR64("2147483648",tmp.TagB[0]); //convert 2^31 to double precision float
 AddR64(tmp.TagC[0],tmp.TagB[0],tmp.TagA[0]); //add the value 2^31 back in, since this is what we masked out earlier, store as a double precision float
 IntToR64(tmp.TagC[0],uint_in); // if the MSB was zero, the function will work as it

result = AsTextR64(tmp.TagC[0]); //convert to string to pass back from program

return result;
Posted in Industrial Automation | Tagged , , , | 1 Comment

Debounce Code for Logix 5000

Here is a Screenshot from 2016-07-15 11:56:04way to debounce the on and off signals in a Logix 5000 PLC:

Posted in How-To, Industrial Automation | Leave a comment

Michael Badnarik Explains how in Increase your Constitutional Kung Foo

20160213_175827~2 When Michael Badnarik ( left Texas almost 5 years ago, I was bummed because I figured I wouldn’t ever have a chance to take his constitution class again.  I was late to the liberty movement and seemed to miss some of the experiences that the veterans had.  It turns out he is back in Texas.  A few local patriots organized one of his classes in Richardson that I jumped on as soon as I heard about it.

His class was great.  I spent most of the time smiling because I had an idea where he was going and I could tell the people around me were uncomfortable hearing some the information he put out there.  I was uncomfortable with some of it.  But he makes you think, and he makes you understand the context and degree of how screwed up the US government is.  His delivery and non-PC, aggressive style of explaining this is the type of communication style I like the best.  If you ever have a chance to hear him speak or take one of his classes, I can’t recommend it enough.  All Americans need to hear and understand his material.

During a break, after he had reminded us that he doesn’t have a drivers license or a CHL or hasn’t filled out any tax forms in years, I asked him how I could increase my constitutional kung foo and be a little closer to his level, without risking being harassed all the time, spending time in jail, etc.  He started with this story:

GROUCHO (to woman seated next to him at an elegant dinner party): Would you sleep with me for ten million dollars?

WOMAN (giggles and responds): Oh, Groucho, of course I would.

GROUCHO; How about doing it for fifteen dollars?

WOMAN (indignant): Why, what do you think I am?

GROUCHO: That’s already been established. Now we’re just haggling about the price.

Badnarik then explained to me that I was like the whore in that story, but maybe more like a slave.  I realize what is going on, and I’m a party to it, and choose to let it happen to me because I see it as the easier path, and I didn’t seem to mind being a slave.  He said the first thing you have to do is decide you aren’t going to be a slave anymore, then things start to fall in place.

Posted in Life | Tagged , , | Leave a comment

Family Pictures November 2015

Posted in Family | Tagged | Leave a comment

Cub Scout Pack 780 Fall 2015 Campout Sack Races

Continue reading

Posted in Uncategorized | Tagged , , , , | Leave a comment

Windows PPTP VPN Setup on LinuxMint 17

After poking around for too long, I finally found the solution to connecting to a standard Windows server PPTP VPN from LinuxMint 17.  (from  I’m posting here to make it easy to find again.

  1. Click the NetworkManager Applet
  2. VPN Connection -> Configure VPN -> -> Add
  3. Choose -> Create
  4. Fill out those gateway, username, password and click Advanced
  5. In Authentication section, CANCEL <PAP>, <CHAP>, and <EAP>, KEEP ONLY <MSCHAP> and <MSCHAPv2> SELECTED.
  6. In Security and Compression section, SELECT <Use Point-to-Point encryption (MPPE)>, and choose Security to be <All Available (Default)>
    OK -> Accept -> Close
  7. Now click the NetworkManager Applet
  8. Click VPN Connection and click the profile you just created.
  9. Wait for few seconds till it get connected.
  10. Done.
Posted in Information | Tagged , , , , , | Leave a comment

Intrinsic Safety Demonstration

At Turck‘s intrinsic safety seminar hosed by Automated Dynamics, I saw a very good demonstration of how safety barrier devices work:  They limit energy to a level that a spark produced will be too weak to ignite the gas surrounding the device it is protecting*.  I sat on the front row and took a little video of this in action.

* provided the device doesn’t store energy through capacitance or inductance

Continue reading

Posted in Industrial Automation | Tagged , , , , , | 1 Comment

No Arc Flash PPE Required for PLC Panels

I’ve heard that PLC and I/O panels need to be designed to exclude 120V wires or circuits because of arc flash requirements.  On Table 130.7(C)(15)(A)(a) of the 2015 NFPA 70E, it states as long as no exposed energized equipment over 120V exists, no Arc Flash PPE is required to work on control circuits 120V and below.NFPA 70E

Posted in Industrial Automation | Tagged , , , | Leave a comment

Judge Napolitano on libertarianism and Catholicism

Judge Napolitano talks about the relationship between libertarianism and Catholicism starting around the 6 minute mark:

the essence of libertarianism is the primacy of the individual over the state …and as far as it is conceivable, absolute freedom of the individual to make his or her own choices.  That’s actually also the teachings of Jesus Christ:  I’ve come to set you free.  …   The doctrine on religious freedom, the doctrine on free will is such that free will is the greatest gift God gave is.  It is so perfect a gift that we are free to abuse it, and history and the modern era is filled with examples of its abuse..   So I see no inconsistency between the observation that the individual is greater than the state, and the Church’s teaching on free will at all.  But I’m also not unaware of the Church’s social policy and the social policy of the church is that I am my brother’s keeper and that I should help my brother out.  I accept that and I embrace it as long as I am free to accept and embrace it as long as I am not forced to do it through the mechanism of government.


Posted in Interesting | Tagged , , , , | Leave a comment