Sign in to follow this  
Followers 0
MBS

reading characters from Raw Serial Port of red lion HMI

9 posts in this topic

hello @ all, I have a G304K from red lion and use mainly Crimson 3 to program the device. Has anyone of you an idea how the program should look like in order to read ASCII-characters from a Raw Serial Port? Therefor the connected camera must be asked with an ASCII-command (e.g. "negative?"). Then it answers on, off or syntax error (if the question is spelled wrong). Sending commands is not the problem - I have already tried it successfully. But I'm not able to receive characters from the camera so far... Thank you in advance, MBS Edited by MBS

Share this post


Link to post
Share on other sites
The way I do it is to send a string from a serial program. I use docklight or realterm to set up the baseline communications. That way you can send the string and you know when and what to except. Once you have that down then. You can have the G3 do the reading.

Share this post


Link to post
Share on other sites
I will try docklight now. With Hyperterminal and realterm I could not setup a communication between the PC and the red lion for an unknown reason:( But sending characters to the camera works...strange! In Crimson, I have realized it like this so far: 1) I created a string-tag "negative_Statusabfrage" 2) I dragged & dropped the tag from the resource window to a screen in order to see the tag name and following the tag value 3) I added a complex action to the field created in step 2: PortPrint(2, "negative?\r"); PortSetRTS(2, 1); negative_Statusabfrage := PortInput(2, 0, 0, 100, 2); Can I do it like this or is there a possible mistake included? Edited by MBS

Share this post


Link to post
Share on other sites
I've never tried it like this, but I have gotten it to work using a program. My method: 1. Setup serial port as System -> Raw Serial Port 2. Under Driver Settings -> On Update, I put my program name, say ServiceSerialPort() or whatever 3. In the program ServiceSerialPort(), I do my PortRead(), PortWrite(), etc. commands. If you want an example, PM me: billysmithde@gmail.com

Share this post


Link to post
Share on other sites
I just tried it like this but it didn't work (a bit as expected)

Share this post


Link to post
Share on other sites
Try PortInput instruction in Crimson.

Share this post


Link to post
Share on other sites
Of course, I have already seen the description in the reference manual for this command. I have also tried serveral different parameters in the brackets. - the portnumber must be the same as for sending characters? - if I want an "O" to be detected as first letter, I have to put in 79 as the second number? - end character to match is 0 in my case because I do not know the end character - timeout 300ms should be enough - maximum number of characters to read: I want to read 2-3 characters Edited by MBS

Share this post


Link to post
Share on other sites
Based on your replies so far, you have tried many things on the software side. This leads me to suspect a wiring or port configuration issue. Please post a link to the camera manual if possible, and if not, please post for us the details of its serial port specification and wiring pin diagrams.

Share this post


Link to post
Share on other sites
I would suggest eliminating all the hand shaking pins just have 3,4 and 5 if you are using an RS232. For some reason my controller does not receive text if all the other pins are present. rafae lmankilla My link

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0