HI:
I need to do a project where I obtain some data in the port RS-232 and I have to send that data from the TCP-IP using the RCM 5700 to a LAN,
The first thing that I`m trying is to stablish a communication within the RCM5700 and the PC, but I still getting bad results… if anyone can help me with this project I really apreciate it…
Several of the samples that ship with Dynamic C do exactly this. Take a look at Samples\RCM5700\TCPIP\ethernet_to_serial.c for a complex example of how to do it.
If you need just a serial-to-ethernet bridge (and none of the fancy web stuff), just use the vserial library. Here’s an example of how I use it:
#define TCPCONFIG 1
#define _PRIMARY_STATIC_IP "10.10.8.4"
#define _PRIMARY_NETMASK "255.255.255.0"
#define MY_GATEWAY "10.10.8.2"
//other TCP settings
#define VSERIAL_DEBUG
#define VSERIAL_NUM_GATEWAYS 2 // forward two serial ports
#define SERE_TXPORT PEDR // serial port E requires custom configuration
#define SERE_RXPORT PEDR
#use "dcrtcp.lib"
#use "vserial.lib"
#use "rcm56xxw.lib" // i'm using the RCM5600W, modify as needed
#define GATEWAY_PORTE 1
#define GATEWAY_PORTD 2
#define EINBUFSIZE 511
#define EOUTBUFSIZE 511
// configuration table for vserial
const VSerialSpec VSerialSpecTable[] = {
VSERIAL_PORTE(GATEWAY_PORTE),
VSERIAL_PORTD(GATEWAY_PORTD)
};
void main(void) {
int bad;
brdInit();
// these may not be necessary for your board and/or may be different
BitWrPortI(PCDDR, &PCDDRShadow, 0, 3); // set serial port C Rx as input
BitWrPortI(PCDDR, &PCDDRShadow, 0, 1); // set serial port D Rx as input
BitWrPortI(PEDDR, &PEDDRShadow, 0, 7); // set serial port E Rx as input
BitWrPortI(PEDDR, &PEDDRShadow, 1, 6); // set serial port E Tx as output
sock_init_or_exit(1);
if (vserial_init()) {
printf("Error starting vserial library
");
exit(-1);
}
// vserial_listen allows the computer to open a telnet connection
// on port 2000. use vserial_open() if you want the rabbit to establish
// a connection to a running server.
if (vserial_listen(GATEWAY_PORTE, 19200, 2000, 0L, 1)) {
printf("Error opening on port E");
exit(-1);
}
if (vserial_keepalive(GATEWAY_PORTE,10)) {
printf("Error setting vserial keepalve!
");
exit(-1);
}
if (vserial_listen(GATEWAY_PORTD, 19200, 2001, 0L, 1)) {
printf("Error opening on port D");
exit(-1);
}
if (vserial_keepalive(GATEWAY_PORTD,10)) {
printf("Error setting vserial keepalve!
");
exit(-1);
}
while(1) {
vserial_tick();
}
}
Thank you tmorton… that exactly what I need to do…Today I will try the code and if I have some cuestions I will ask again… I apreciate your help…Guachi
I have another question… Where did you use the code that you send me… I’m trying to prove it but I still without having any result…what i need to do is: receive some data from 4 parameters of a power transformer and sending over ethernet where another program(labview) will receive the information and analized it… if you have some ideas I will apreciate them…
I used the program to take data from underwater sensors and output it to a telnet client (I used Teraterm).
I’d try running the Samples\RCM5700\TCPIP\ethernet_to_serial.c sample program and see if that does what you want, since it was written explicitly for your board.