Red Lion G3 Serial problem

Clay B.

Lifetime Supporting Member
Join Date
Jun 2005
Location
Concord,NC
Posts
1,304
I am tring to get some information from a weight controller to a G306 HMI. The data is ASCII.

What I am looking for is some examples on how to program the G306 to send ASCII data out and recieve via the RS485 port. I have searched the Red Lion Web site without much success.
 
I don't have a sample, are you familiar with the internal program section of the G3? Set port to Raw Serial Port. Put the Program you are running your code in the "On Update" field

Data := PortRead(1, 100) reads what's been sent to the port
PortWrite(1, "ABCD") sends strings out the port

For conversion from the strings to numbers, you have TextToInt and TextToFloat. IntToText and FloatToText can be used to convert numbers to text going out
 
I think you hit the nail on the head there. I am not familar with the internal programing of the Red Lion. Up till now everything I have done is strickly PLC to HMI.

I have been playing around with PortInput function. The PortRead seems to be simpler.

Thanks TW. I think I am going to play with PortRead and see if I can get some results.

Question: The tag I store too. Do I have to declare that as a local variable to this program or can I just use a Tag?
 
Last edited:
I have four scales (all ASCII based) into a Master Controller in production now, two over serial ports and the other two through a serial-to-ethernet converter. Send me a PM and I can email you the file.

PortRead() works, but I find PortInput() to be a little easier if the return data is amenable to this function. I also use PortPrint usually, but I don't remember why exactly. I think I only ever used PortWrite once when I had to send a specific hex character to the wire. I think at the end of the day its just a matter of style which functions you use.
 
From what I have read in the manual the difference between PortWrite and Port Print is in PortPrint you can send a string where in PortWrite you can only send a single charactor.

Either that or i am reading this manual wrong...
 
You don't have to declare tags as local variables

PortPrint would probably be easier than the PortWrite for strings...what was I thinking...

Here is a down and dirty sample of sending ASCII out

// declare locals
cstring line;
line = "Write this";
line += DecToText(TagInDatabase, 0, 2, 1, 0, 0);
line += " to the serial port";

PortPrint(1, line);

EDIT - You figured the PortWrite and PortPrint out correctly
 
Cool..so reading this manual is finally paying off. I wanted to trow it across the room today but the manual is in my laptop and I can not afford a new laptop. I am going to be doing some more to this project tomorrow, I will post what I come up with.

I must say though, the more i mess with these G3's the more I like them. You really have some hidden power under the hood of these things.
 
It is amazing what you can do with one. One my latest project we are toying with manipulating tags from a cell phone through the G3 programming. It is working nicely so far
 
I must say though, the more i mess with these G3's the more I like them. You really have some hidden power under the hood of these things.

I was able to hack together a ModbusRTU driver in the programming environment so I could run Modbus along with another custom protocol at the same time. Also I was able to write an SMTP server so a G310 could receive email. The functions they provide are simple, but I find them to be a 'complete' set. In the limited instructions they provide I find I can do almost anything.
 
I was able to hack together a ModbusRTU driver in the programming environment so I could run Modbus along with another custom protocol at the same time. Also I was able to write an SMTP server so a G310 could receive email. The functions they provide are simple, but I find them to be a 'complete' set. In the limited instructions they provide I find I can do almost anything.


I am, knocking around with it today and I see what you are talking about.

Your example pointed me in the right direction... My main issue was not my code but my comms setup... Wrong number in the Stop bits.

Rule to live by...never ignore the obvious.


Thanks to you and TW for the help...I will post my code on this thread once I get it "prettied" up.
 
I have four scales (all ASCII based) into a Master Controller in production now, two over serial ports and the other two through a serial-to-ethernet converter. Send me a PM and I can email you the file.

PortRead() works, but I find PortInput() to be a little easier if the return data is amenable to this function. I also use PortPrint usually, but I don't remember why exactly. I think I only ever used PortWrite once when I had to send a specific hex character to the wire. I think at the end of the day its just a matter of style which functions you use.


robertkjonesjr do you think it would be possible to get a copy of this from you? I know it was year ago but thought it was worth a try. I have an application where I need to communicate with several serial instruments.
 

Similar Topics

Hi All, I am looking to install a Red Lion CR3000 HMI and connect it to a Mitsubishi FX3u 64M PLC via Serial. I cannot find confirmation on...
Replies
8
Views
2,841
Hi, has anyone ever setup an Adam 4572 Modbus TCP/IP to Modbus serial convertor? I am trying to use one with a Red Lion DSPSX but cannot...
Replies
5
Views
4,397
I am trying to do my initial download to this Red Lion Kadet (G307K200), and because we didn't purchase Red Lion's specific cable, I made my own...
Replies
8
Views
3,253
Hello, I am attempting to set up a database using a DSPSX000. I am connecting to a device that outputs a results file via RS232 at the end of a...
Replies
17
Views
7,655
Hi, I am going to try and download a database to a G308 via the serial port. Reading the Crimson 3.0 manual I cannot find anything about port...
Replies
5
Views
2,804
Back
Top Bottom