A few people have been complaining about an error when compiling the ArduinoFirmware.ino sketch about the timerISR function. It only showed up on some computers. This version fixes that bug.
There’s a bug where, if you link an output to an internal coil, and then delete the internal coil, the saved file can’t be opened again. This version provides a work-around where it breaks the link upon opening it, which at least lets you get to your program and fix the problem.
I’ve also added a new Up/Down Counter instruction. This instruction works a bit differently than the Count Up and Down Down timers. It counts up on the rising edge of the rung-in condition. It has a separate Count Down input which causes the internal count to decrement by 1 with each rising edge. It also has a Reset input, which sets the internal count back to zero (and it’s reset-dominant, so as long as Reset is on, it ignores the Count Up and Count Down pulses). The rung-out (or output coil) is on when the internal counter is zero, and false otherwise.
You can download the new version over at the SoapBox Snap Project Page.
Traditional PLCs let you peek and poke at memory addresses directly with commands like MOVE, etc. In SoapBox Snap, the ladder language is designed around a more strict Functional Programming model, but that doesn’t mean you can’t conditionally latch a number into a memory location.
Take a look at how the Choose Number instruction selects value A0 when the input turns on, but otherwise chooses its own value. This creates a form of internal state, similar to a sealed in coil.
An astute SoapBox Snap user pointed out a problem with the counter function blocks in the Arduino Runtime over the holidays (thanks Miguel!) and I tracked down the bug and fixed it. The bug was there all along but only seems to cause problems on newer versions of the Arduino compiler.
Please download version 2016.01.03 of SoapBox Snap and make sure you download the Arduino Sketch to your board to get the fix. You can get the latest download on the SoapBox Snap product page.
This version also fixes a bug in the new Export Signal Table function of the Arduino Runtime.
SoapBox Snap version 2015.11.01 has just been released, with a bug fix (dragging and dropping an instruction to the left of itself could cause an editor crash) and a new feature: the ability to export a lookup table of signals and addresses to a CSV file (for the Arduino Runtime).
If you’re using the Arduino Runtime for SoapBox Snap and you want to hook it up to something over the serial port, you’ll need to be able to read and write signal values. Due to space limitations in the Arduino, storing the lookup table between signal name and address is just too costly, so there was no easy way to figure out which address your coil signal was in. This release adds an Export Signal Table feature to solve this problem.
Go to Tools -> Options… and find the SoapBox Snap Arduino Runtime options page. Check the box called Export Signal Table, and enter a (fully qualified) directory where you want the table exported to. Now every time you do a download of your program to the Arduino, Snap will create a CSV file listing the address, signal type, signal name, and the comment. Now you can lookup which address corresponds to which signal name.
SoapBox Snap version 2014.07.06 has just been released! You can download it from over at the SoapBox Snap Project Page.
This version adds an Arduino runtime, meaning you can now download SoapBox Snap ladder logic programs to an Arduino and use your Arduino like a PLC. Currently it’s compatible with the Arduino UNO and Nano boards (R3). The SoapBox Snap download includes a firmware sketch (written in C++) which you’ll have to upload to the Arduino in the normal way.
To get you started, I’ve written a complete SoapBox Snap Arduino Tutorial.
As usual, SoapBox Snap, and the SoapBox Snap Arduino Runtime code, is released as open source.
Note that this version of SoapBox Snap no longer has the Game Controllers module in it (due to installer issues). That means the original soft runtime won’t support joysticks and other game controllers.
The initial version will have support for the UNO (R3) and the Nano (R3) versions of the Arduino boards. The ladder logic is stored in the internal EEPROM of the chip.
As always, all of the source code, including the Arduino sketch that allows it to act like a PLC, will be released as open source under a GPLv3 license. More will be coming soon.
If you tried SoapBox Snap with a 64-bit operation system and had a problem, we apologize. If you try the new download, it should work better for you.
We’ve just put a new version of SoapBox Snap up for download (version 2011.03.01). This version adds a new I/O driver for DirectX compatible game controllers.
That forces you to disconnect from the runtime after reading the configuration. You can just re-connect and choose to download your application if you want to try it out right away. You will be able to see the discrete inputs light up when you press the buttons on your controller. To see the analog inputs (axes) working, you’ll need to use those somewhere in your logic.
What’s next? New drivers for even more I/O hardware… stay tuned!
Version 2010.11.15 of SoapBox Snap is now available for download. It includes 11 new Math and Comparison operators for the ladder logic module. This fills in most of the missing functionality you need to make good use of the NUMBER type in your applications.
That’s a really lean type system compared to most PLCs (but of course, “Snap is not a PLC”). If you’ve done much traditional PLC programming, you would expect to see a dozen different numeric types, like BYTE, INT, UINT, DINT, UDINT, not to mention SINGLE, and DOUBLE precision floating point numbers, and various BCD numbers if you’re really lucky. At first when I was writing SoapBox Snap, I planned to support every data type in the IEC-61131-3 standard, but I realized all those types only existed because traditional PLCs are so memory constrained that you had to take memory usage and low level memory management into account when you use them. One of the goals of SoapBox Snap is to remove the burden of memory management from the programmer. That’s why there’s only one NUMBER type and it can represent any number.
SoapBox Snap already used the NUMBER type in the Counter and Timer instructions that shipped with the first version. The counters expose a Count output that you can access just like any other signal. Likewise, the timers expose an Elapsed output (in milliseconds). Of course, all analog inputs in your Device Configuration also expose NUMBER type signals, and all analog outputs consume NUMBER type signals, so now you can manipulate all of these signals with the new instructions below.
The new math instructions carry out your four basic mathematical operations: add, subtract, multiply, and divide. Each takes two NUMBER inputs, and produces a single NUMBER output. Since a result is generated, all of these instructions are considered “right hand” instructions (that is, they show up on the right hand side of the rung). They all use the rung-in condition to enable the operation. If the rung condition feeding the instruction is false, the result stays the same as it was during the previous scan. If the rung condition is true, the result is overwritten with the new result of applying the operation to the two inputs.
There is one exception: if the second input to the divide instruction is zero, it disables the instruction from executing, so the result will stay the same as the last scan. There are various alternative ways it could handle a divide-by-zero condition (throwing an error, setting the result to zero or infinity, etc.), but I thought that holding the last “good” value was the most reasonable thing to do.
These are your basic comparison operators. They are all “left hand” instructions, so they go on the left side of the rung, where you normally use contacts. Each one takes two NUMBER inputs, just like a Math instruction, but doesn’t generate an output, other than the rung-out condition. If the rung-in condition is false, the rung-out condition will always be false. If the rung-in condition is true, the instruction will read both inputs, apply the comparison, and set the rung-out condition to the result of the comparison. Therefore you can chain these comparison operators together on the same rung (for instance to say A > 250 and A < 750).
Similar to the Math instructions (in that it has two NUMBER inputs and one NUMBER result) is the new Choose Number instruction. This instruction copies the first input to the result if the rung-in condition is true, and otherwise it copies the second input to the result. If you use this instruction in combination with a Greater Than instruction, then you can easily implement a Maximum instruction. That is, if A > B, return A, else return B.
You are currently browsing the archives for the Soapbox Snap category.