![]() at connector CN5 on the Axiomtek SBC84620.Ī bash script to list all threads of the program, showing including the priorities and CPU times:Įxample output with main (light-weight process (LWP) 1609), which started the serial reading threads (LWP 16), the timing thread for polling (LWP 1634), ![]() Digital I/O Port (DIO), 8 input pins and 8 output pins, e.g.at connector CN36 on the Advantech PCM-3356. 8-bit general purpose Input/Output (GPIO), bidirectional 8 pins which must be configured, e.g.The program can easily be modified to use ports which are very similar to parallel ports, e.g.: Maybe more data of the same data packet). Of serial data the time stamp is changed to the one from the last part and finished at the timeout at the end (waiting for The buffering is also necessary for the correct time order of the data, because at every defragmentation The data from serial ports are also buffered and printed with a latency of some milliseconds,īecause serial data are generally fragmented the data packet often do come in n > 1 parts, especially when they are relative long,ĭetected by the small time differences between the n packets. Their data from the last polling, because they need some microseconds to do this and do not always have the Printed as one block, and the evaluation/defragmentation waits if not all parallel reading threads have committed The optional threads have a dashed rectangle, the non-optional a solid.Īfter the start and warmup the structure is more complicated, a mixture of theĪn important point is that the data are logged defregmented: The input from the parallel ports is always The thread structure (left picture) is at the program start as in the common Boss/Worker model: The main() thread is the Boss and creates one reading thread for every specified port (func_serial_read(), func_parallel_read(), func_parallelport_read()), the timer thread (func_timer()) when there is at least one parallel reading thread (func_parallel_read(), func_parallelport_read()), and the flushing thread only when there is something to do (instead of exit()). Has real time priority (best possible priority, will be sheduled first (in user space)). If more than one thread writes to a variable, a mutex or semaphor would be necessary, so i avoided this.Įach class of threads has another priority, due to the time criticality of the class.įor efficiency the priorities are choosen without leaps and the timer thread, for triggering the reading of parallel digital data by port reading, So global variablesĪre used only when necessary and only one thread does write to a global variable.įor global variables bigger than a word ((computer_architecture))Ītomic read and write would be necessary, so i avoided them. So for k serial ports and y= parallel ports the program uses 2 + k + ( y ? y+1 : 0) threads.īecause of the threads, the program is made thread safe. Serial ports is at worst case below 40 µs at onboard ports and port on PCI(e) cards.įor writing the log file to the disk periodically there is also a flushing thread. Typically every 34 µs under a Linux Kernel with the Preempt-RT patch. The program uses one thread per input because select() and pselect()Ĭan not handle more than one port with i) low latency and ii) correct order of the incoming bytes.įor orthogonality there is also a timer thread which triggers the parallel reading threads periodically, the output of an analog to digital converter (ADC). With a direct port access to toggle an output pin before every read access it is easy to read converted data synchronous,Į.g. Ioctl() with a higher latency but good portability. With direct port access for a low latency of about 1.5 µs or the 4 input pins of a serial port with )ī) a transient recorder/digitizer, for logging parallel data from the input pins of serial ports and/or parallel ports, Multithreaded_logger is a C program and a hybrid ofĪ) a logging program which logs serial data (RS-232, -422, -485, CAN, Ethernet. In the subdirectory doxygen/working/, and the output is placed in the subdirectoryĭoxygen/output/, via "doxygen doxygen/working/Doxyfile". The documentation is generated with the configuration file Doxyfile Project multithreaded_logger, logging of serial and/or parallel data, with defragmentation Program multithreaded_loggerĬurrent source code: multithreaded_logger.c.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |