473,396 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ASCII characters in my hex output

I am using pyserial to work with a device on my serial port. the
output is a mixture of ASCII and hex:

Ex. '\x10\x00*'
I need conver the \x00* nuber in to decimal. Is there way to
convter this value striat forward?
Thanks in advance
Kelia Nichols
______________________________________
No trees were killed in the sending of this message. However a large
number of electrons were terribly inconvenienced.


Jul 18 '05 #1
2 5118
nuvodido wrote in message ...
I am using pyserial to work with a device on my serial port. the
output is a mixture of ASCII and hex:

Ex. '\x10\x00*'
I need conver the \x00* nuber in to decimal. Is there way to
convter this value striat forward?


You're not being specific enough. Here are some things to look at:

Pyserial for your serial port-ing needs.

Struct module for C-structs. Array module for homogenous binary data.

Have a look also at ctypes and xstruct (both external modules).

chr() and ord() builtins; shift and binary arithmetic operators.

I suspect what you are asking is something like:

struct.unpack('=bh', '\x10\x00*') -> (16, 10752)

But again, how can I know?
--
Francis Avila
Jul 18 '05 #2
Kelia,

Google,
" binascii.hexlify "

at

http://groups.google.com/groups?hl=e...mp.lang.python
If your converting a Basic program, I did the same and you can
find it by googling 'Eurotherm'.

--yaipa

"nuvodido" <ke**********@ssdd.nrl.navy.mil> wrote in message news:<ma**************************************@pyt hon.org>...
I am using pyserial to work with a device on my serial port. the
output is a mixture of ASCII and hex:

Ex. '\x10\x00*'
I need conver the \x00* nuber in to decimal. Is there way to
convter this value striat forward?
Thanks in advance
Kelia Nichols
______________________________________
No trees were killed in the sending of this message. However a large
number of electrons were terribly inconvenienced.

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Ian | last post by:
I'm using the following meta tag with my documents: <meta http-equiv="Content-Type" content= "text/html; charset=us-ascii" /> and yet using character entities like &rsquo; and &mdash; It...
8
by: Bernhard Hidding | last post by:
Hi, my program writes chars to an ascii file via ofstream. You can use "\n" for newline and "\t" for tab there, but is there any command that deletes the last char in the current ofstream? Thanks...
1
by: | last post by:
Hey all, Quick question...been bugging me for some time, really. I have a console app, it does some things, and I want to save an array of text to a text file. The text consists of ASCII and...
5
by: lkrubner | last post by:
I know I'm missing something obvious, but I looked hard at this page and did not see the format of the return specified: http://us3.php.net/manual/en/function.ord.php >From the limited example...
5
by: b.stewart | last post by:
I have only been using C++ for a few afternoons and i still get confused at nearly every line i type so maybe someone here can help me. Im trying to write a small program that can change a...
4
by: wob | last post by:
Many thanks for those who responded to my question of "putting greek char into C string". In searching for an solution, I noticed that there are more than one version of "Extended ASCII...
18
by: Ger | last post by:
I have not been able to find a simple, straight forward Unicode to ASCII string conversion function in VB.Net. Is that because such a function does not exists or do I overlook it? I found...
6
by: ssetz | last post by:
Hello, For work, I need to write a password filter. The problem is that my C+ + experience is only some practice in school, 10 years ago. I now develop in C# which is completely different to me....
4
by: meendar | last post by:
Hi, I am having a character pointer which contains ascii values. i just want to convert all these ascii values to respective characters and again store it in another character pointer. ...
14
by: jt | last post by:
hello everyone.., i'm using ubuntu 8.04 OS. I'm not able to output the non-printable ascii chatacters. for eg. printf("%c",1); // nothing is outputted..... is there any way to output these...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.