DL06 PRINT statement and leading zero's

XtremeIN

Member
Join Date
Jun 2005
Location
Indiana
Posts
217
Hello all,
I am working on a project that sends data via a serial connection to a Raspberry Pi. So far everything is going well but the customer has a request that I have yet to figure out how to do. When using a Vmem in a PRINT box is there a way to place leading zeros on the Vmem value, Say the reading is 8o, but I want it to display/send 080.

Thanks,
Micheal

This is the current PRINT statement:

"PR012345678900" V4200 "" V4201 "" V4202 "" V4203 "" V4204 "" V4205 "" V4206 "" V4207 "" V4250 "" V4251 "" V3566 "" "$N"

The result is:
PR012345678900 80 80 80 80 80 80 80 80 80 80 853

The desired result would be:
PR0123456789000800800800800800800800800800800853
 
Could you do it on pi side I would add a a Special unique character or sequence between each vmem like_%_ then explode you data on the pi side into an array iterate through it and pad it depending on the value of the number and then stick it back together.

You could do it on the dl side as well by concatena ting a string using conditionals on each vmem but it may prove cumbersome
 
It was requested by the guy doing the Pi programming. I think it has to do with the way he is wanting to separate the data package being sent via the PLC. He would like each data package sent to be the exact same length. I told him that is probably the one thing that I cannot do, but was hoping someone would have an idea/solution.

Thanks,
Micheal
 
You could always load you values onto the stack run a for next loop using pop to get the values out to a holding register and run a few compares

If less than 100 vprint "00" vmem next
If less than 1000 vprint "0" vmem next

Then printv to output string

I have never tried it before but it may work
You would also have to load onto the stack in reverse order ie 3566 first and 4200 last
 
Check out the VPRINT instruction to build the string in memory. It has more formatting capabilities. Then use PRINTV to send the completed string.
 

Similar Topics

Hi, Mostly AB guy here with a little Koyo experience, but all of its digital. I get handed three analog I/O cards and asked to prove that they...
Replies
6
Views
495
Hi all, I am making a test rig to be able to wire in any DL06 (or DL05) And create a HMI in red lions crimson 3.1 to test all the inputs and...
Replies
4
Views
927
I have a Cmore screen which is communicating to the DL06 in BCD and need to create a timer that works in real numbers for a test, I simply need to...
Replies
3
Views
2,121
I have a client that has many Automation Direct DL06 PLCs for a municipal water/wastewater system. When there is a power outage, one of the sites...
Replies
4
Views
2,438
Hey everyone, Working on a system with a Koyo DL06 processor and it's my first experience with them. I have DirectSoft 6 and we got the program...
Replies
5
Views
2,313
Back
Top Bottom