vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi All I am doing a project recently requires RS232 communication between a hpux workstation and a robot. This machine has its own RS232 communication protocol which can accept commands and return result from queries. The RS232 connection requirement is very simple. the workstation the machine 9 pins connector 25 pins connector Pin 2(Rx) connected to Pin 2(Tx) Pin 3(Tx) connected to Pin 3(Rx) Pin 5(Gnd) connected to Pin 7(Gnd) Ive wrote a C code to control the machine. Apparently, the machine is accepting the commands from the C program and performed its tasks, but wouldnt response to the queries that Ive sent from the program. Therefore Ive probe(pin2 - Tx) from the 25 pins Dsub connector and found that the machine is actually returning the expected result but the serial port is not set to read the result. The read result return -1. I am not a RS232 programmer and this is the first time I am doing so. But I think it must something to do with the RS232 options that I should set in my hpux box. All kinds of RS232 related helps are appreciated. Thanks in advance. ~ |
| |||
| linda wrote: > Hi All > > I am doing a project recently requires RS232 communication between a > hpux workstation and a robot. This machine has its own RS232 > communication protocol which can accept commands and return result > from queries. The RS232 connection requirement is very simple. > > the workstation the machine > 9 pins connector 25 pins connector > > Pin 2(Rx) connected to Pin 2(Tx) > Pin 3(Tx) connected to Pin 3(Rx) > Pin 5(Gnd) connected to Pin 7(Gnd) > > Ive wrote a C code to control the machine. Apparently, the machine is > accepting the commands from the C program and performed its tasks, but > wouldnt response to the queries that Ive sent from the program. > Therefore Ive probe(pin2 - Tx) from the 25 pins Dsub connector and > found that the machine is actually returning the expected result but > the serial port is not set to read the result. The read result return > -1. > > I am not a RS232 programmer and this is the first time I am doing so. > But I think it must something to do with the RS232 options that I > should set in my hpux box. > All kinds of RS232 related helps are appreciated. Thanks in advance. > ~ I'd say, first try with a terminal emulation program like minicom or kermit, or even cu to see if communication is actually happening, assuming the robot protocol uses human-readable instructions and responses (using "normal" ASCII). If that works, you can debug your program, by connecting a terminal to the serial port, after checking it's functionality with the terminal emulator. If you don't have a terminal, but jou have a second serial port, you can use that one. Just create a cable with two 9-pins connectors, according to the description below. 9-pin serial null-modem cable 9-pin serial A 9-pin serial B Pin 2 (Rx) connected to Pin 3 (Tx) Pin 3 (Tx) connected to Pin 2 (Rx) Pin 5 (Gnd) connected to Pin 5 (Gnd) I'm not a RS232 programmer myself. If I need something like that I use expect, cu, dip, minicom, kermit, or any combination of those. So, if you post the parts of your program concerning the serial connection, someone else might be of some help -- Alex |
| |||
| On 20 Sep 2004 07:24:21 -0700 plinda77@yahoo.com (linda) wrote: > I am not a RS232 programmer and this is the first time I am doing so. > But I think it must something to do with the RS232 options that I > should set in my hpux box. > All kinds of RS232 related helps are appreciated. Thanks in advance. Start here: http://www.stokely.com/unix.serial.p...ces/index.html -- Stefaan -- "What is stated clearly conceives easily." -- Inspired sales droid |
| |||
| Hallo, linda! We had a similar problem with RS232 connections on HP Dxxx Servers and newer. The reason in our case was because the port on the HP Servers required additional signals, such as "ready to receive" and so on. The solution: plug-in two bridges in the 25-pin connector at the HP side of the connection, one from pin 4 to 5, the other from pin 6 to 8 to 20. I'm pretty sure that there is a HP-UX command to set the serial port options so that it doesn't need the bridges, but we never found that... Hope this helps, Wolfgang |
| |||
| > Hallo, linda! > > We had a similar problem with RS232 connections on HP Dxxx Servers and > newer. The reason in our case was because the port on the HP Servers > required additional signals, such as "ready to receive" and so on. > The solution: plug-in two bridges in the 25-pin connector at the HP > side of the connection, one from pin 4 to 5, the other from pin 6 to 8 > to 20. > > I'm pretty sure that there is a HP-UX command to set the serial port > options so that it doesn't need the bridges, but we never found > that... > > Hope this helps, > > Wolfgang Hi Wolfgang Thanks for the advise. But I'd tried these already. For my case(9 pins connector), it is shorting pin 1,4 and 6; and shorting pin 7 and 8. But it is still not working. I wonder why. Can you send me the part of your code(and those settings that u have in your code) that is reading from the serial port? I would like to compare it with mine, if you dont mind. thanks linda thanks |
| |||
| linda <plinda77@yahoo.com> wrote: > Thanks for the advise. But I'd tried these already. For my case(9 pins > connector), it is shorting pin 1,4 and 6; and shorting pin 7 and 8. > But it is still not working. I wonder why. > Can you send me the part of your code(and those settings that u have > in your code) that is reading from the serial port? I would like to > compare it with mine, if you dont mind. Did you set cread with tcsetattr? urle -- Uli Betzler (urle) urle@rz.uni-karlsruhe.de Universitaet Karlsruhe, Rechenzentrum IRA/VERA/SR, Zirkel 2, 76128 Karlsruhe phone: +49 721 608-4039 FAX: +49 721 608-9013 alternate FAX: +49 721 32550 urle = URL-Emanation = http://www.uni-karlsruhe.de/~Ulrich.Betzler/urle.html |
| |||
| "Wolfgang Friedrich" <news@janewolfgang.de> wrote in message news:BD76212Dyf@janewolfgang.de... > Hallo, linda! > > We had a similar problem with RS232 connections on HP Dxxx Servers and > newer. The reason in our case was because the port on the HP Servers > required additional signals, such as "ready to receive" and so on. > The solution: plug-in two bridges in the 25-pin connector at the HP > side of the connection, one from pin 4 to 5, the other from pin 6 to 8 > to 20. > > I'm pretty sure that there is a HP-UX command to set the serial port > options so that it doesn't need the bridges, but we never found > that... Turning off 'hardware handshaking' generally lets you get around problems like that. Easy to do in minicom, I'm not familiar with how you do that in general. -Dave |
| |||
| Hi All, here's my test code... #define ENQ 5 #define ACK 6 #define NAK 15 #define STX 2 #define ETX 3 #define QUERY "XX" /* XX, something to represent an query, say 2 bytes */ int main() { int fd; int io_status; int write_status; int close_status; struct termio t; char *device = "/dev/devicefile"; char query[10]; char recvbuf[10]; sprintf(query, "%c%s%c\n", STX, QUERY, ETX); /* need to encapsulate QUERY between the STX and ETX, to be recognize by the robot */ if((fd = open(device, O_RDWR | O_NOCTTY | O_NDELAY))==-1) fprintf(stderr, "Open RS232 Fail%d!\n", fd); if((io_status = ioctl(fd, TCGETA, &t))==-1) fprintf(stderr, "IOCTL TCGETA Fail!\n"); t.c_cflag=B9600|CS8|HUPCL|CREAD; if((io_status = ioctl(fd, TCSETA, &t))==-1) fprintf(stderr, "IOCTL TCSETA Fail!%d\n", io_status); if((write_status = write(fd, &query, 5))==-1) fprintf(stderr, "Write RS232 Fail!%d\n", write_status); /* let say the query returns 2 bytes, YY */ /* actual data return from robot and received will be "2YY3" but ascii character 2 and 3 is not printable(is this the problem?) therefore it will be YY, as STX, "YY", ETX */ if((read_status = read(fd, &recvbuf, 5))==-1) fprintf(stderr, "read RS232 Fail!%d\n", read_status); printf("%s", recvbuf); /*returns nothing */ /* read_status received but is 0*/ close(fd); } /* End of code */ Is there any settings that are capable of filter away the STX and ETX during read? or it that needed? thanks linda |
| |||
| Hi All Forgot to mention...about this machine, - utilizes a standard RS232C datalink - incorporating a single character protocol - interrupt mode for input - polling and non interrupt mode for output - uses a single character start of text(STX) and single character end of text(ETX) to allow variable length strings to be sent as data. - baud 9600 - start bit, 1 stop bit - 8 bit data length - none parity - full duplex thanks again linda |
| ||||
| Hallo, linda! > Thanks for the advise. But I'd tried these already. For my case(9 pins > connector), it is shorting pin 1,4 and 6; and shorting pin 7 and 8. > But it is still not working. I wonder why. Ups - I haven't read your posting correctly at first, thought that the 25 pin connector is on the workstation. Yes, there are other pins to shorten in this case, I don't know which ones, I think you are correct with 1,4,6 and 7,8. > Can you send me the part of your code(and those settings that u have > in your code) that is reading from the serial port? I would like to > compare it with mine, if you dont mind. Sorry, there is no code that I can send to you. In most cases we simply want to connect a serial modem for support reasons with 3 pins (send, receive, ground). So the code in our case is the standard getty process. In some cases it was a communication program, which sends and receives data to/from other machines. This program has the same problem on the HP-UX systems. The program code is not free, and I am by no means a programmer, so I see no chance to sent (the right) parts to you. In any cases the connections were running without any problems after applying the bridges in the connector. We tested this with kermit for example. We are using the 800 Servers, perhaps there are differences to your 700 Workstation?! Wolfgang |