Hi! I have to develop a control system, so I get a Hercules-EBX Board (Diamond Systems Corporation) and a little touch screen. The touch screen should be controlled via the serial port (RS-232). And here is my Problem… I try to write a very simple program to test the basic functions. First off all I try to read from the COM1, so I provide a null-modem-cable and connect the QNX-Board with my Windows-XP PC. Then I start BRAY-TERMINAL at the XP-PC and send a series of characters trough the cable (the PC really sends the characters, I have controlled the output with an oscilloscope). The program at the QNX-Board (a little inspired by an other topic) looks as followed:
#include <stdio.h>
#include <stdlib.h>
#include
#include <fcntl.h>
#include <iostream.h>
using namespace std;
int main()
{
printf(“Start”);
int fd;
int numRead=0;
char buffer[255];
fd = open("/dev/ser1", O_RDWR | O_NOCTTY | O_NDELAY );
while(1)
{
memset(buffer, 0, sizeof(buffer));
numRead = read(fd, buffer, sizeof(buffer));
delay(100);
printf("\n fd..%i numRead..%i buffer..%s",fd,numRead,buffer);
}
close(fd);
return 0;
}
OK… the result is that I get this output on my console:
Start
fd…3 numRead…-1 buffer…
fd…3 numRead…-1 buffer…
fd…3 numRead…-1 buffer…
fd…3 numRead…-1 buffer…
fd…3 numRead…-1 buffer…
fd…3 numRead…-1 buffer…
So we know that the program can open the/dev/ser1 but reading is not possible.
Can somebody please tell me what to do?!?
regards Marco