Click here to learn the biblical way to get to heaven! (The most important page on this site)
You can have your very own virtual server though VPSLink! Using REFERRAL code MJDCDJ you will receive a 10% discount on
your new account, and I will get a service credit on my account. My personal preference is the Link 2 package running XEN for starting out (You can upgrade any time). You can choose from a variety of Linux distributions such as CENTOS, Fedora, Debian, and Ubuntu. This is a great package for learning Linux,
and setting up your own web page, or email server.
Counters
Counters count rung transitions. The CTU runs the accumulated value of the counter up on the false to true rung transition, and the CTD instruction runs the accumulated value down. The CTU and CTD can be used in conjunction with each other.
Counters consist of the following components:
ACC Accumulated Value PRE Preset Value
CD Count Down Bit CU Count Up bit
OV Overflow Bit UN Underflow bit
Tags used for counters are declared with the COUNTER data type. Here is an example:

For the CTU instruction: The CU bit is high when the CTU instruction is true. The ACC value increments by the value of 1 each time the CU bit goes high. When the ACC reaches the PRE, the DN bit will be set. The CTU will continue to increment the accumulated value until it reaches the maximum possible value for a 32 bit signed integer (2147483647). If the CU bit goes high one more time, the OV bit will be set, and the ACC value will go to -2147483648. Each time the CU bit goes high, the ACC value will still continue to increment (become less negative).
For the CTD instruction: The CD bit is high when the CTD instruction is true. The ACC value decrements by the value of 1 each time the CD bit goes high. Any time the ACC is above or equal to the PRE, the DN bit will remain set. The DN bit is reset if the ACC falls below the PRE at any time. The CTD will continue to decrement the accumulated value until it reaches the minimum possible value for a 32 bit signed integer (-2147483648). If the CD bit goes high one more time, the UN bit will be set, and the ACC value will go to 2147483647. Each time the CD bit goes high, the ACC value will still continue to decrement (become less positive).
Here is a practical example of a CTU/CTD implementation:

Each
time a pizza goes into the oven, the ACC value is incremented by one.
Each time a pizza comes out of the oven, the ACC value is
decremented by one. Therefore, the ACC
value represents how many pizzas are in the oven at any given time.
The DN bit could be used to shut the conveyor down if pizzas are
going into the oven and not coming out!
