There are a couple of reasons that could happen, but the most common is that you're alternator is not recharging your battery fully. While you're driving, the residual charge from the battery is getting very close to zero, and the alarm goes off because "IT" thinks someone is tampering with the electrical system.
BUT.....if that were the case, it SHOULD NOT just happen while you're driving! It should also happen while the truck is sitting in your driveway....probably....because the drain will happen there, also.
So, its something to check....easy to check....and easy to repair.
Remember, the alarm system will ALSO go off, even while driving, "IF" there is a problem WITH the alarm system. But, that gets a little tougher to diagnose and costs more bucks. I like to check the least expensive and easiest first.
Hope this helps...and GOOD LUCK!