Questions tagged [serial-port]

A serial port is a physical interface through which data is transferred (uni- or bidirectionally) one bit at a time. Largely superseded in the consumer market by USB, serial connections are still commonly used in many other specialist applications. Typical applications include scientific/medical instruments, industrial controllers and server diagnostics...

Filter by
Sorted by
Tagged with
2
votes
0answers
60 views

Await data coming from an event [closed]

This is a USB related question, but the problem is not USB specific. When reading data from a USB endpoint, there are two patterns I am concerned with. Request/Response like HTTP (done over the Bulk ...
1
vote
1answer
48 views

Serial port library for unix systems in C using callback model

I wrote a blocking serial port library, Blocking serial port C library, but prefer non-blocking so wrote this library where user can specify callbacks. So it is event driven. The code assumes C99 or ...
2
votes
0answers
36 views

Blocking serial port C library

I am planning to write a reasonably feature rich serial library but wanted to cut my teeth on something fairly basic. This serial library is fairly simple. It is a thin wrapper on the UNIX open, ...
2
votes
1answer
59 views

Handling command code and response code in serial port's DataReceived method

I have a function which contains two switches, which check for Command Code and Response Code after that updating UI elements. The code is working fine. How I can reduce or improve those switch cases?...
10
votes
0answers
345 views

Asynchronous serial port communications class in C++

Please review my serial port class written in C++. It is completely asynchronous, ie event driven. My idea for later is to inherit from this a sync_serial, where timeouts can be specified and it ...
4
votes
3answers
122 views

Function to check if received message matches any of the expected messages

I have a message coming in and I need to match it against the expected messages. The program will eventually do something as a result of receiving those messages. I am not very experienced at ...
1
vote
0answers
55 views

Simple Serial Port Windows Interface

I implemented a very simple blocking uart interface. Most of the serial instruments I interface with are master/slave and I have to wait on data to proceed forward. I am contemplating add some ...
4
votes
2answers
215 views

ROS node to control Dynamixel servo motors

This code is for a ROS (http://www.ros.org/) node that controls a pair of servo motors (referred to in the code as grippers) that can be controlled individually or together. When they are controlled ...
2
votes
2answers
753 views

Reading range sensor data from one Serial Port and writing output to another

I'm reading range/distance sensor data from one Serial Port, decoding it and then transmitting it to a secondary device in ASCII format. The sensor uses a 2-byte header with each byte containing the ...
1
vote
0answers
446 views

A simple and efficient packet frame encoder/decoder

I have written a simple packet-framing class, for converting un-encoded 'packets' into encoded/delimited 'frames,' to be sent over a P2P serial connection. The functionality is based on the RFC 1662 "...
4
votes
1answer
871 views

A library that reads incoming scale data from USB

I made a simple C# library which detects incoming data from 1 or 2 scales plugged into a computer's usb. My main concerns: I feel like I should potentially be using events/delegates to process the ...
1
vote
0answers
33 views

Sending AT commands via switch case in Arduino

Is this the proper use for switch case? I am looking to make a simple utility for reporting back Wireless AP info, Baud Rate, and Mode of a ESP8266 module. When the program loads it gives the user a ...
2
votes
0answers
2k views

Serial Port Wrapper with Internal Blocking Buffer

Here I have some complete working code but some aspects seem questionable to me. What I have done is written a wrapper for the Microsoft serial port (...
1
vote
0answers
98 views

Sending data from UART to microcontroller via AT89C2051 functioning as a UART/SPI bridge

I have an unusual setup. I have an AT89S52 microcontroller in which its UART is used by the PC. I needed a way to make a second UART based device work with it, so what I decided to do was make a UART ...
3
votes
1answer
46 views

Two bidirectional Software UARTs with AT89S52 microcontroller

I have learned one way to read from a serial port via software UART is via timer interrupts. I have made an implementation of receiving data from one serial port below. I haven't tested it yet because ...
4
votes
1answer
269 views

8051 RFID reader for Atmel microcontroller

I am currently using an AT89S52 microcontroller for a major project that involves a use of an RFID reader that outputs data in a serial format (9600 baud, no parity, 8 data bits, 1 stop bit). The ...
3
votes
0answers
1k views

Structure of a serial port reading program

I am writing a serial port communication app. And I thought I could get some feedback about the general structure of the program. If I am doing MVC correct, etc. Since this is a "large" program I ...
2
votes
1answer
118 views

Arduino Create and send data to Serial Port (Software Serial function)

I have this code written and functioning that will write out the chars in cmd to a serial port for an input of two int values. As the majority of the byte values ...
8
votes
1answer
1k views

Wrapping libusb library in C++

I want to use libusb library in my C++ application. I have created classes which wraps libusb functions. You can see that libusb API is split into 8 sections: http://libusb.sourceforge.net/api-1.0/...
3
votes
1answer
646 views

4x4 Matrix Keypad on Arduino UNO

I recently bought a 4x4 keypad. It is one like this: http://www.learningaboutelectronics.com/images/4x4-matrix-keypad-pinout.png Now every code I found on the net was either using a highly overloaded ...
4
votes
2answers
7k views

Serial Port Communication

This is an efficiency question to the following code, written in MS Visual in C#. If any explanation is missing, please let me know and I will add. What this part of the program does is: Button is ...
3
votes
0answers
565 views

RC Plane Radio using the Raspberry Pi

This python code is for a homemade RC plane radio using the Raspberry Pi and a USB joystick. It sends values over serial to DSM2/X module for RC planes and other RC vehicles. This Python code is ...
1
vote
1answer
9k views

Read and write data to/from Serial Port in C#

I am building a console application which will be scheduled in Task Scheduler of Windows to run my code every day at a set hour. Summing up, this application will read and write through serial port. ...
1
vote
1answer
5k views

Serial port data plotter in PyQt

I am rather new in GUI programming and multi-threading apps. It is just a serial port monitor which plot serial data via pyqtgraph. There are two curves on the ...
4
votes
2answers
1k views

Handle data sent back over serial by Arduino

I have a machine that is being controlled by an Arduino. If I send the machine the command '9' it will send back JSON with some sensor temperatures in the format ...
1
vote
1answer
2k views

Basic GNU/Linux C++ serial I/O class

I have wrote a small C++ class that provides some basic serial I/O functionality (it uses the standard GNU/Linux API). At this stage is working fine, before adding new functionality I want to get ...
4
votes
2answers
317 views

Simple meter simulator

I've created a simple python meter simulator which connects to a serial port (in my case COM1) listens on the serial port and takes actions based on what it ...
2
votes
2answers
5k views

C# SerialPort implementation

I'm writing a C# WPF project built with a MVVM pattern. This software is written to use a medical diagnostic device, so in our planning it will be certified IEC 62304. Since I've been mainly writing ...
3
votes
0answers
129 views

Atmega328 watchdog, sleep and external interrupts

I have a customised Arduino board that will be connected to a battery and never power reset (it needs to be very reliable and cope with code hangs). The board will always be put to sleep when not in ...
2
votes
0answers
250 views

Fetching a weather report on an Arduino from a web service

I'm writing some code which is basically supposed to http get some information from my own website and parse it, which (finally) works. However, when I compile the code, it shows this: Sketch uses ...
1
vote
1answer
856 views

Modbus connection over TCP and Serial port

I want to improve my code. In this code I don't like my constructor, but without it I keep getting an error while trying to connect NullPointerException. ...
2
votes
1answer
428 views

RPi script to periodically collect data from Arduino through serial port

I'm not used to Python. The script opens serial communications with an Arduino unit and send commands to and receives information from the Arduino. It is intended to run indefinitely until the system ...
7
votes
1answer
4k views

Verilog UART Transmitter

This is one of the first Verilog programs I have written. I have a Xilinx Artix-7 FPGA card. Right now I just have it transmitting an "X" every second. It works and I can see the result in my serial ...
4
votes
2answers
9k views

Find a serial port device through WMI (windows management instrumentation)

The idea here is to be able to find a USB serial port device connected during runtime, thus not knowing its port number, and use it in the application to retrieve information from the device. ...
2
votes
1answer
232 views

Arduino serial data input output

I have created an Arduino sketch that I am using to send and receive data via serial. It works pretty well and doesn't seem go wrong as long as the correct formats are received. Is there anything I ...
4
votes
1answer
1k views

Controlling motors using USB serial connection from Raspberry Pi to Arduino

I am working on building an RC car/robot with Raspberry Pi and Arduino. I connected Arduino to Raspberry Pi using USB and send serial commands with python. I haven't done much programming with ...
5
votes
1answer
662 views

Robot arm manipulation library

I have created a DLL library that controls an robotic arm. Could you tell me if my design is correct? The robot communicates over serial port. The code works but I would like to receive a feedback ...
-4
votes
1answer
446 views

Read from Serial Port in C++ is unstable [closed]

I have a serial device (RS232) from which I am requesting (binary) data. This interface answers with a sequence of 5 bytes, or 17 bytes when it has some new data. I figured out, that I have to turn ...
5
votes
1answer
147 views

Writing a class to hold Arduino Properties for an Arduino I2C Debugger

I have this class which mostly holds a bunch of properties and their setters. I also have wrappers for some functions of another module. Here is the class: ...
2
votes
2answers
2k views

Serial-data read buffer handling

This is a follow-up to yesterday's codereview-question about reading serial data and parsing it. The code below is run into a seperate thread looped endlessly. Currently I track the position in my <...
5
votes
2answers
6k views

Read binary serial data and parse integers

I'm reading serial data in binary format from a stream, and I'm not happy with how I extract the data because it takes so much operations to extract the binary data from a simple line of binary data. ...
5
votes
1answer
1k views

Dynamic length binary data parsing

I am currently writing code for a UART communication in my firmware. I am getting an interrupt every byte received (meaning I don't get a chunk of data, 1 byte at a time but, in the sample below I ...
2
votes
2answers
2k views

Serial port write buffer

I'm writing to some serial comm port with specific bytes set into buffer. My protocol for write buffer is written below. Platform is Windows and IDE is Visual C++. Byte 0 will have message type ...
5
votes
2answers
4k views

Open a comm port and send an ASCII string

This is my first ever project and first GUI. I have finished it (with help from Stack Overflow) and it works but is very slow. Can anyone suggest improvements for speed, best practices or usability.? ...
6
votes
1answer
8k views

Async SerialPort Wrapper

I've been working with the SerialPort class for a while, trying to figure out the best way to work with it, and especially adding support for Async-Await in C#. I ...
1
vote
1answer
112 views

Reading HTTP response from UART

I'm using a Telit GE864-GPS modem, which runs a dialect of Python 1.5.2. The Python module has access to the modem using a buffered UART, which may still be receiving when reading starts. The ...
5
votes
1answer
2k views

Serial port for Node.js

I am trying to create a class for serial port using Node.js, but I want to know if there is a better way to write my data class code. In my sample code below, in the ...
3
votes
1answer
2k views

Python lookup table

I'm trying to design a protocol for sending/receiving serial data. The basic plan is to allow for text data to be entered in the command prompt, translate that to a hex string and send it out over ...
5
votes
1answer
4k views

Programming Principles - Reading/writing from/to a Mifare card

Consider the following class (I've stripped XML doc for the sake of simplicity), which does several and slightly different operations through a serial port to read/write from/to a Mifare card. It has ...
11
votes
1answer
2k views

Door-opener program

I've been working on a little project on an Arduino and I need some help with making the code more efficient / cleaner. I really don't like the three for loops and ...