Home > other >  Failure in a serial port to send and receive data
Failure in a serial port to send and receive data

Time:09-27

Excuse me how to implement a serial port with vxworks and servo (or serial links to another computer on the serial port installed on another computer assistant shows a semaphore) program, is the programs are written by the workbench, and then burn in the development board, and then passed to the other 422 computer (install another computer serial assistants and display data)

CodePudding user response:

As long as it is VxWorks support serial port driver, just create a serial port to send the task directly

CodePudding user response:

BSP serial port driver is no problem, just make the synchronous with a TASK1, other TASK to write the log, it is sent directly to the TASK1, synchronization can be transmitted by semorphone ensure timing

CodePudding user response:

reference 1st floor VxWorks_developer response:
as long as it is VxWorks support serial port driver, directly create a serial port to send the mission line
, two serial ports whether to add a judgment while (1)
{
FD_ZERO (& amp; ReadFds);
FD_SET (g_serialFd, & amp; ReadFds);
FD_SET (g_serialFd1, & amp; ReadFds);
Width=(g_serialFd & gt; G_serialFd1? G_serialFd: g_serialFd1) + 1;
If (ERROR==select (width, & amp; ReadFds, NULL, NULL, NULL))//(to check the digits from 0 * * read the FDS in the FDS abnormal FDS * * * * * * wait for the maximum time, empty=forever)
{
continue;
}
If (FD_ISSET (g_serialFd, & amp; ReadFds))
{
The count=read (g_serialFd, (char *) & amp; Control word, 16);
Printf (" print a serial port 1 closed ");
}
If (FD_ISSET (g_serialFd1, & amp; ReadFds))
{
The count=read (g_serialFd1, (char *) & amp; Control word, 16);
Printf (" print a serial port 2 closed ");
}
But now a serial port 2 of incorrect

CodePudding user response:

refer to the second floor netlark response:
BSP serial port driver is no problem, just make the synchronous with a TASK1, other TASK to write the log, it is sent directly to the TASK1, synchronization can be transmitted by semorphone ensure timing
, two serial ports whether to add a judgment while (1)
{
FD_ZERO (& amp; ReadFds);
FD_SET (g_serialFd, & amp; ReadFds);
FD_SET (g_serialFd1, & amp; ReadFds);
Width=(g_serialFd & gt; G_serialFd1? G_serialFd: g_serialFd1) + 1;
If (ERROR==select (width, & amp; ReadFds, NULL, NULL, NULL))//(to check the digits from 0 * * read the FDS in the FDS abnormal FDS * * * * * * wait for the maximum time, empty=forever)
{
continue;
}
If (FD_ISSET (g_serialFd, & amp; ReadFds))
{
The count=read (g_serialFd, (char *) & amp; Control word, 16);
Printf (" print a serial port 1 closed ");
}
If (FD_ISSET (g_serialFd1, & amp; ReadFds))
{
The count=read (g_serialFd1, (char *) & amp; Control word, 16);
Printf (" print a serial port 2 closed ");
}
But now a serial port 2 there is an error

CodePudding user response:

Why want to use the POSIX API ah, I give you the way VxWorks only WRITE way, also is the way of input log, in LINUX is equivalent to the READ - WRITE LOCK,
If you want to read, then plus a TASK_READ, then it is ok to send the message to TASK_READ from interruption,

CodePudding user response:

Two-way serial port receive independent, can create two receiving task, serial port initialization configuration only at system startup configuration, don't put in tasks,
Your two way serial task is different, don't put in a task, the design thinking of going to the coupling after maintenance is helpful for you,

CodePudding user response:

Oh oh ok, thank you
  • Related