LED Display

Hi All,

I am working with a big LED display which interfaces with the PC by RS232 (9600 baud,no parity , 2 stop bits , 8 bit, no hardware flow control ). I am trying to write my own application using cygwin on vista using open , read and write function calls. Every thing works data is comming out of com2 but is not read by the LED display , I have written a basic programm which sends data to the LED display this works. I think it is something to do with the way I configure the serial port, can anyone check my code to initialise the port -

s->connected=0; /* reset in case we fail to connect | O_NOCTTY */

s->fd = open("/dev/ttyS1", O_RDWR | O_NOCTTY | O_NDELAY); if (s->fd == -1) return 0; else fcntl(s->fd, F_SETFL, FASYNC);

//fcntl(s->fd, F_SETFL, 0);

tcgetattr(s->fd, &options);

/* go to 9600 baud */ cfsetispeed(&options, B9600); cfsetospeed(&options, B9600);

options.c_cflag |= (CLOCAL | CREAD); /* enable */

options.c_cflag &= ~PARENB; /* 8N1 */ options.c_cflag |= CSTOPB; options.c_cflag &= ~CSIZE; options.c_cflag |= CS8; //options.tcflag_t |= CIGNORE ; options.c_cflag &= ~CRTSCTS; options.c_cflag &= ~CRTSXOFF;

/* set all of the options */ tcsetattr(s->fd, TCSANOW, &options);

s->connected=1; return 1;

the other thing could be the serial cable and DTE -DCE set up I have ruled it out by testing with TX connected with RX of the LED display and vice versa. ANy help is appreciated. thanks Rate

Reply to
ratemonotonic
Loading thread data ...

Can it be CTS RTS need connecting?

Reply to
TT_Man

The LED display doesnt support Hardware flow control. The basic program I wrote works without flow control as well , I cant figgure out anything diffrent between the logic of the basic program and the c program

Reply to
ratemonotonic

According to your comment - /* (8N1)*/ - you are setting it up for a single stop bit. Is this what you intend? You said 2 at the start...

Cheers TW

Reply to
Ted

At one point you say "2 stop bits", but your comment here indicates 1 = stop bit. I don't know anything about your platform so I can't say = whether your comments or your code are in error, but they do differ.

8N2 is an unusual requirement.

--=20 Jim

Reply to
Jim Mack

bit. I don't know anything about your platform so I can't say whether your comments or your code are in error, but they do differ.

Hi , I Agree it is an odd requirement , but with my basic programe it works with both 2 and 1 stop bit. and it doesnt work with the C programme with both the settings. Sorry I should have mentioned that. My platform is cygwin running on vista.

Thanks Niladri

Reply to
ratemonotonic

If you don't especially need UNIX compatibility, remember that another easy way to interface to the serial port is to use any of the .NET languages (C#, Visual Basic), version 2005 or later. There is a free "Express" C# development system.

Reply to
mc

... snip ...

If you use it only for transmission you gain a bit on the clock accuracy required, at the cost of transmission speed.

Please don't exceed 72 chars in transmitted lines. 67 is better.

--
 Chuck F (cbfalconer at maineline dot net)
   Available for consulting/temporary embedded and systems.
Reply to
CBFalconer

You have a big advantage -- a working system to compare against. Monitor all the lines and compare what the Basic program is sending and what your other application is sending. Try to mimic the working signals in your second program.

--
Thad
Reply to
Thad Smith

I have a serial port sniffer programme which moniters my com port , the exact same out put is sent to the serial port by both programmes , but the c programme doesnt work! I have also used a scope to monitor activity on the tx line and there is always some data sent ( although I have not decoded the bit pattern yet) . As I mentioned before the C programme transmits correctly to my palm top directly (DCE)and to another PC with null modem. And the data sent is always correct.

Can the issue be to do with timing i.e. the basic programme is interpreted and is a lot simple? where as I use read and write library function (overhead etc.) and the LED driver is not tolerant of such delays?

Thanks Rate

Reply to
ratemonotonic

Hi , I dont understand this last comment why is 67 better? Thanks Rate

Reply to
ratemonotonic

... snip ...

... snip quoted sig area ...

Because the lines are shorter, and better able to withstand quoteing. Also, please ensure you snip all sig areas, unless you are commenting on them.

--
 Chuck F (cbfalconer at maineline dot net)
   Available for consulting/temporary embedded and systems.
Reply to
CBFalconer

This may be belabouring the obvious but since the results are different the inputs must be different.

Have you verified the baud rate?

I think you have that backwards, an interpreted basic program is morelikely to have delays than a compiled C program. A quick check would be to insert some arbitrary delays into your C transmissions.

Robert

--
Posted via a free Usenet account from http://www.teranews.com
Reply to
Robert Adsett

I really do not understand, why you would need more than 4 levels of quoting.

It is much readable to write a few line summary, then use 1-2 levels of quote and then add your own text.

Paul

Reply to
Paul Keinanen

Feel really daft asking this but what is quoting ?

Reply to
ratemonotonic

Nothing wrong with asking. Quoting is what you do when you include some portion of the message to which you are replying in your message. Quoted lines are normally marked with an initial '>' character, and the count of those initial '>'s is the level of quoting. If you look at the attributions (lines like "Joe wrote:" at the beginning) you will find the author of the lines has one less than the quote level of '>' before the attribution (assuming somebody hasn't fouled them up).

The point of quoting is that Usenet is not a reliable transmission medium, and there is no guarantee that your reader has ever, or ever will, read the originals of the quoted portion. Thus it is necessary that all messages stand alone, and the art is to remove enough quotes to avoid excess transmission, and yet carry the sense of the whole message.

The links shown in my sig. below should help.

--
Some useful links on quoting:
Reply to
CBFalconer

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.