BOOL, the integer family, REAL/LREAL, STRING and TIME โ the bricks everything else is built from. Each has a size, a range, and a trap. The nastiest: pick a type too small and your counter silently wraps.
Pick an integer type, then keep adding. When you pass its maximum it doesn't error โ it wraps back around to its minimum. This bug ships in real machines. Watch for the flip.
๐๏ธ REAL vs LREAL. REAL is 32-bit (~7 digits); LREAL is 64-bit (~15 digits). For accumulating position or money over millions of cycles, use LREAL โ REAL's rounding adds up.
๐ฃ BOOL & bit-packing. A BOOL is one bit of meaning but the controller may store it in a byte/word. Pack flags into a WORD when space or fieldbus layout matters.
๐ค STRING & literals. Strings have a declared max length; TIME literals like T#1s500ms and dates have their own syntax โ mix them up and the compiler complains early.
๐ Convert deliberately. Sysmac is strongly typed โ use INT_TO_REAL etc. on purpose, and watch truncation when going from a wide type to a narrow one.
A USINT holds 255. Your code does count := count + 1. What's the new value?