Using Portprint in Red lion Crimson 3

Rshepler

Member
Join Date
Jul 2014
Location
PA
Posts
3
I am having trouble getting data out of a Red Lion Graphite 09. I am using the Printport command to send data to my computer. I can see the data but there is no seperation and I cannot use my software to assing it as variables. Is there a way to seperate the lines with spaces or comma's? This is all new to me and any help would be appreciated. Here is a small portion of the current version:

PortPrint(3, Main.Customer.Customer) ;
PortPrint(3, Main.Location.Location) ;
PortPrint(3, Main.Currentuser[0]) ;

PortPrint(3, Main.Names.M1_name ) ;
PortPrint(3, "M1_Flow="+DecToText(Meters.M1_flow,0,2,2,0,0) ) ;
PortPrint(3, "M1_Total="+DecToText(Meters.M1_total,0,4,1,0,0) ) ;

PortPrint(3, Main.Names.M2_name ) ;
PortPrint(3, "M2_Flow="+DecToText(Meters.M2_flow,0,2,2,0,0) ) ;
PortPrint(3, "M2_Total="+DecToText(Meters.M2_total,0,4,1,0,0) ) ;

Thanks in advance for your assistance.
 
Add +"\r\n" or +"\n" (depending on whether you need both carriage return and newline, or just newline on your receiving device) to your PortPrint. Or +" " for space, or +"," for comma: you get the idea...
PortPrint(3, "Hello " + variableName + "\r\n");
PortPrint(3, variableName +"',");
Portprint(3, variableName + DecToText(otherVarName) + "\n");
 
Last edited:
Do you want each item to be an individual line or one line comma separated? Either way you will probably want a carriage return at the end of your send.
Several ways you can do this. You can lump all values into a single string variable with each element separated by a comma (below).

CString SendStr;

SendStr := Main.Customer.Customer + "," + Main.Location.Location + "," + Main.Currentuser[0] + "," + Main.Names.M1_name + "," + "M1_Flow=" + "," + DecToText(Meters.M1_flow,0,2,2,0,0) + "," + "M1_Total=" + "," + DecToText(Meters.M1_total,0,4,1,0, 0) + "," + Main.Names.M2_name + "," + "M2_Flow=" + "," + DecToText(Meters.M2_flow,0,2,2,0,0) + "," + "M2_Total=" + "," + DecToText(Meters.M2_total,0,4,1,0, 0);

SendStr := SendStr + "\r\n";
PortPrint(3, SendStr);
 
The entire thing can be one long one but I need each item seperated by a comma or space.

Thanks Str8jCkt I will give that try.
 

Similar Topics

I have a project to automate four generator sets. The system will monitor and store the load demand of the factory. Once there's Power outage, the...
Replies
0
Views
55
Adding ethernet equipment to an existing panel that has none. We have some solid ethernet cables coming from other remote cabinets that I plan to...
Replies
3
Views
116
I'm trying to control a device via MODBUS RTU and the ModbusRtuMasterV2_PcCOM in Twincat 3. I've configured a device with the right com port and...
Replies
7
Views
221
Hi, I'm trying to use the IO Device Library (Product Versions) which is configured to work with the 1756-EN4TR & 1756-EN2TR but my system uses...
Replies
0
Views
59
Hello, As part of our project, we are using an M241 controller. This controller interfaces with an industrial computer and a router via a switch...
Replies
2
Views
104
Back
Top Bottom