[En-Nut-Discussion] Re:UART Bug

Conor Duke conorduke at yahoo.co.uk
Mon Jan 26 15:07:02 CET 2004


Dear List,
hey this is kind of a simple problem but i am only starting so i figure experienced people will be able to fix it.
I am trying to develop a Remote monitoring system for a PLC controller(an omron 1).
I am communicating to the plc via the UART serial port on the Ethernut board and processing the results.
I can't seem to initialise the UART at the correctly.
I am using a patch work of code i got from the HTTPD server programme but when i Intialise the UART like so (see Below)
FILE *UART;
void UARTint(void)
{u_long baud = 9600;
 u_long datab = 7;
 u_long stopb = 2;
 u_long parity = 2;
 u_long fctl = 0;

/*Registering UART device*/

NutRegisterDevice(&devUart0, 0, 0);

/*Opening Stream (UART)*/

UART = fopen("uart0", "r+b");

/* setting Baud Rate,data bits,parity and stop bits*/
_ioctl(_fileno(UART), UART_SETSPEED, &baud);
_ioctl(_fileno(UART), UART_SETDATABITS, &datab);
_ioctl(_fileno(UART), UART_SETSTOPBITS, &stopb);
_ioctl(_fileno(UART), UART_SETPARITY, &parity);
}
 The whole programme hangs and the webpage won't open.
I have tried using th stdout format in httpd.c (see end) but i can't read from this but i can't open a stdin device  with out the programme hanging.
 
Should i be threading the whole process if it runs sequentially?
Any help on using the UART would be of great help
Kindest Regards
Yours in Expectation
Conor


---------------------------------
  Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.egnite.de/pipermail/en-nut-discussion/attachments/20040126/6f24b81f/attachment-0001.html>


More information about the En-Nut-Discussion mailing list