dalegambill / pythonterminal Goto Github PK
View Code? Open in Web Editor NEWSerial Com Port Data Terminal written in Python 3.5 on Windows 10
Serial Com Port Data Terminal written in Python 3.5 on Windows 10
Dale Gambill, 3/10/2018 I wrote this serial data program in Python 3.5 so that I could compare it to the one I wrote in C#. I wrote TERMINAL.PY and SERIAL_RX_TX.PY on Windows 10 using the Pycharm IDE. These two modules show you how to use serial COM ports on Windows 10 to do the following: - send and receive lines of text terminated with \n - handle received data with your own event-handler - send lines of text at regular intervals from a file (replay a log file)
Hello Dale.
I love your code. I am just learning PY. I work testing very long serial cables either RS-232 or RS-432 or RS-485. I have an old laptop with Windows XP and a hardware serial port. I use it to test cable.
So, My plan is to put short the send and receive together at the distant end of the cable.
I put my laptop with the PY BERT software on the other end of the cable.
I have started a program in Python that 1st asks for the com port#, then the baud rate. I leave the defaults for the Pyserial as 8 bits, no parity and 1 stop bit.
So, then the program asks how many characters to send. I usually test at 9600 baud, so I enter 20,000 characters.
I then start a for loop and say that i=range (numcharacters)
and then I build a very long string
SendSTR=("")
I put that above the input line to declare it but make it empty.
Then I do a loop that creates a random ASCII number and appends it to the SendStr variable.
That loop repaeats the numcharacters # of times so we now have a very long string.
Then, on character at a time(again, I am thinking a loop) that sends one caracter from the generated string down the serial line, then receives it back( the distant end is in a loopback on the wires) then I compare what was sent with what was recieved. If the two are equal, sent chars counter increments by 1, but error counter remains zero. If the recieved character was NOT what was sent, then the sent character increments by 1 but the Error counter also increments by one.
This is repeated until the entire 20,000 character string is sent.
Then the loops are done and a report is printed:
Print (charsend+ " characters sent.")
Print (errors+ "Recieved")
Then I do some math to come up with a percentage of the errors to sent successfully.
Of course, I am new at this and this is not the best code, but it is good enough.
What do you think?
Maybe you can make something like this quicker than me, I suppose.
I am not sure if I am on the correct tab in Github to just chat about a thing.
I enjoy your code. It inspires me to continue, but I must look into the Class and the Def things.
Thank you for posting this.
Hi, I have a question.
If I can write to a port in C++ and read in python simultaneously.
Thank you so much.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.