Hi,
I am trying to set-up communication to the coin change-giver from my
Linux box using the Python code. The change giver uses MDB (Multi Drop
Bus) serial protocol to communicate with the master. MDB protocol is
the 9bit serial protocol:
(TX, RX lines only) 9600bps, 9bits, No Parity, 1 Start, 1 Stop.
I would like to control the UART "parity bit" to try to simulate 9bit
communication.
Using Pyserial it is possible to set the parity bit as ODD, EVEN or
NONE.
I have found in the following link (paragraph 21.3) http://howtos.linux.com/howtos/Seria...1.shtml#ss21.1
that UART hardware supports two "rarely used" parity settings as well:
mark parity and space parity (these setings are also known as "sticky
parity")
A "mark" is a 1-bit (or logic 1) and a "space" is a 0-bit (or logic 0).
For mark parity, the parity bit is always a one-bit. For space parity
it's always a zero-bit.
Does anybody here knows some "tricks" how to set up the mark and space
parity on the UART (using pyserial???), so I can simulate 9bit
communication? (I know it sounds silly, but I would like to try to
re-configure the UART parity before each byte transmission).
Any comment will be appreciated.
Petr Jakes 2 12140
On 2005-11-03, Petr Jakes <pe**@tpc.cz> wrote: Using Pyserial it is possible to set the parity bit as ODD, EVEN or NONE.
Correct. Those are the parity settings supported by pretty
much all platforms.
[...]
Does anybody here knows some "tricks" how to set up the mark and space parity on the UART (using pyserial???),
What OS? Mark and space parity are not supported by the Unix
termios API that is used to do serial port stuff.
so I can simulate 9bit communication? (I know it sounds silly, but I would like to try to re-configure the UART parity before each byte transmission).
I suspect you're going to have to talk to the UART yourself to
do this.
In addition to the problem with mark/space being unsupported,
you have to wait until each byte is completely sent (including
the parity bit) before changing the parity and loading the next
byte into the data register. Many OSes "drain" functions are
notoriously inaccurate.
--
Grant Edwards grante Yow! Did I say I was a
at sardine? Or a bus???
visi.com
To provide feedback:
I have found the way how to control serial port parity bit on the Linux
(how to set the parity bit to the "mark" or "space" parity) within
Python using termios module.
With the help of: http://www.lothosoft.ch/thomas/libmi...paceparity.php
=============== =============== =========
import serial
import termios
import TERMIOS
ser=serial.Seri al('/dev/ttyS0', 9600, 8, "N", timeout=1)
iflag, oflag, cflag, lflag, ispeed, ospeed, cc = termios.tcgetat tr(ser)
cflag |= PARENB | CMSPAR # To select SPACE parity
cflag &= ~PARODD
cflag |= PARENB | CMSPAR | PARODD # to select MARK parity
termios.tcsetat tr(ser, termios.TCSANOW , [iflag, oflag, cflag, lflag,
ispeed, ospeed, cc])
=============== =============== =========
Using above mentioned it is possible to establish 9bit serial
communication according to the given protocol specifics. It is
necessary to control parity bit setting before sending each
communication byte.
Regards
Petr Jakes This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Martin Goldman |
last post by:
Hello all,
I've been struggling for a few days with the question of how to convert
"smart" (curly) quotes into straight quotes. I tried playing with the
htmlentities() function, but all that is doing is changing the smart
quotes into nonsense characters. I also searched the web for quite a
while and was unsuccessful in finding a solution.
What puzzles me is that doing it the other way around is simple enough.
For example, this works...
|
by: Mark Moore |
last post by:
I'm trying to layout a couple text input fields and their
corresponding labels without using a table. When I was trying to
debug my understanding of CSS, I was *very* surprised to see that
span's with borders behave counter-intuitively (IMHO) when using
style="white-space: nowrap;".
Below is a fairly small chunk of XHTML that demonstrates what I'm
talking about. What gives?
-Mark
|
by: Sandman |
last post by:
I'm having some problem here...
I have a javascript I've downloaded that goes through all PNG files and enables
the transparency channel in them for IE5.5+ by converting them to SPAN layers
with the image as background.
This works great until I put one of these PNG files inside a display:none block
and later sets the block to display:block - then the SPAN (that was the PNG
<img>) remains hidden.
|
by: Robert Mark Bram |
last post by:
Hi All,
I am using the following trim function:
function trim (str) {
return str.replace(/^\s*/g, '').replace(/\s*$/g, '');
}
The problem is that this doesn't trim instances of the " " char -
the non breaking space. Can this be represented in a grep statement at
|
by: mairhtin o'feannag |
last post by:
Hello,
I have a tablespace striped across three drives, call them 1,2,3, just to
be clever. :) I allocated a lot more space (DMS) than I should have,
since I didn't know a way to estimate the space required (long story, but
the original space was in one huge tablespace for all tables ((35 million
row tables)) and I needed to segregate them out into separate tablespaces
for backup and restore purposes.
So I allocated, like 4 million...
| |
by: napi |
last post by:
I think you would agree with me that a C compiler that directly
produces Java Byte Code to be run on any JVM is something that is
missing to software programmers so far. With such a tool one could
stay with C and still be able to produce Java byte code for
platform independent apps. Also, old programs (with some tweaking)
could be re-compiled and ported to the JVM.
We have been developing such a tool over the last 2 years and currently...
|
by: Mark Harrison |
last post by:
So I have some data that I want to put into a table. If the
row already exists (as defined by the primary key), I would
like to update the row. Otherwise, I would like to insert
the row.
I've been doing something like
delete from foo where name = 'xx';
insert into foo values('xx',1,2,...);
|
by: taoberly |
last post by:
A few months ago I posted a question about using a file on my hard
drive to perform cross-frame scripting and pull data from a server on
my company's intranet. I eventually got this working using an HTA file
and Internet Explorer.
Now I'm tackling a similar issue, but really need to keep the IE menus,
navigation buttons, etc. this time around. Assuming a solution exists,
I'm guessing it involves using the IE6 SP2 "Mark of the Web"...
|
by: Lloyd Bonafide |
last post by:
I followed a link to James Kanze's web site in another thread and was
surprised to read this comment by a link to a GC:
"I can't imagine writing C++ without it"
How many of you c.l.c++'ers use one, and in what percentage of your
projects is one used? I have never used one in personal or professional
C++ programming. Am I a holdover to days gone by?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |