Hex String related problem
Hi,
I like to add 20hex string together & divide by 20 but somehow i can't get the correct result.
Attach with my vi here.
thanks and regards,
Simon
Solved!
Go to Solution.
Attachments:
Untitled 1.vi 13 KB
Here's my idea mentioned above (eliminates coercions and orange wires).
Message Edited by altenbach on 12-17-2009 12:18 AM
LabVIEW Champion . Do more with less code and in less time .
Attachments:
HexAverage.png 7 KB
HexAverage.vi 8 KB
Similar Messages
-
Problems when changing hex string to integer.
Hi
I am trying to change a hex string to an integer. I have done this using the following code:
theinteger = Integer.parseInt(thestring, 16);
this works for every hex number up to 7fffffff (Hex). As soon as I go to 80000000 (Hex) a number format exception occurs.
Does any know why this is happening as the highest number I need to go to is ffffffff (Hex).
Thanksyou must parse it to long.
7FFFFFFFF is the highest number that a int can hold.
0x80000000 being the lowest negative number.
Anyway, parsing to long should take care of the problem. -
How to add leading zeros to hex string?
Hi, I've got the following problem:
I have a string that represents a 8-digits hexadecimal number. But if the number has less as 8 digits, I need to add the leading zeros. I can't use DecimalFormat, 'cause it works only with decimal numbers. Is there any elegant solution to add the leading zeros to hex string (for example "A3F" to "00000A3F")Or better use a StringBuffer for that, though I doubt it's a performance problem in your case.
-
I am new to LabView, so please bear with me...
I tried to communicate with an RS485/2-wire device through COM1. I used Instrument I/O Assistant (and Advanced/Basic Serial Write and Read examples) to write command (HEX string) to COM1,
tried writing HEX strings with and withour end bye (is 0D0A the correct end signal for HEX string?). Both didn't get device's responce. Looks like the device didn't recognize the command.
I monitored the transmitted signals on the bus, they were not differential as supposed to be.....
What is the possible reason to cause this? Please help...
The hardware connection is OK, because I am able to communicate with the device through COM1 (with the same command) using different software application.How are you sending the hex? Is your string control set for hex display or normal? If it's set for normal, then if you send something like 'AD', then you aer sending the ASCII characters 'A' and 'D' and that's not the same thing. I don't believe the I/O assistant can send hex but you can modify the basic serial write and read to do so. Just right click on the string control and select 'Hex Display'. You can also enter the data in a numeric control (set for dex display) and use a type cast or an array of U8's and use the Byte Array to String function. Hex data usually doesn't use any kind of termination characters such as CR/LF.
If communication is working with another app, then as you said, the hardware is okay and it's not a problem with differential signaling. -
Single precision to hex string
Hello,
I was wondering how to typecast a SGL Or DBL into a hex string? I tried number to hex, and format into string, etc but can't seem to figure it out.
The stirring doesnt need a sgl/dbl and is fine but the heating needs to work at a decimal point. since the device must multiply the heating by 10 (inputting 80 degrees gives out 800 to the device and it sets it to 80 degrees) turning it into a hex string shouldn't be a problem but i can't seem to figure this out.
Any help would be appreciated.
Thanks
Attachments:
single to hex.JPG 33 KBI meant like this which most closely represents what you did for the U16 conversion at the bottom half of your code.
Attachments:
Example_VI.png 15 KB -
Hex string and normal string concatenat​e issue
Hello,
what i have is a hex string and a normal string which i want to concatenate into one string. the problem is that in the output concatenated string you need to select either "normal display" or "hex display" in the properties. the problem is if you select hex display then the normal string is converted into hex and if you select normal display then the hex value is not correct. is there a way to display the hex value in normal display mode?
attached is a vi showing the problem
Attachments:
hex to string.vi 7 KBlfoitek wrote: ... i am creating a state machine and then translating it into string representation ... i just can't figure out how to do the conversions to display the correct output.
If by "correct output", you mean you want something like 4bytes (0xBADDF00D) converted to 8bytes ("BADDF00D" in normal display), then there are several ways ...
Message Edited by Donald on 08-31-2006 04:17 PM
=====================================================
Fading out. " ... J. Arthur Rank on gong."
Attachments:
HexHeadaches.jpg 24 KB -
Convert a byte/Byte - HEX STRING ?
Hi ,
My Problem is , I want to convert a byte/Byte value to hex string. If there is any way to convert bytes to hex strings then please tell me.
please help me.Integer.toHexString(byteValue);
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Integer.html -
Problem description:
I have ordered a new iMac but my current one seems to be running really slowly. I believe it to be a memory related problem but can’t seem to identify what is causing it. Your help is greatly appreciated.
EtreCheck version: 2.1.8 (121)
Report generated March 7, 2015 at 4:01:26 PM PST
Download EtreCheck from http://etresoft.com/etrecheck
Click the [Click for support] links for help with non-Apple products.
Click the [Click for details] links for more information about that line.
Hardware Information: ℹ️
iMac (24-inch, Early 2008) (Verified)
iMac - model: iMac8,1
1 2.8 GHz Intel Core 2 Duo CPU: 2-core
2 GB RAM Upgradeable
BANK 0/DIMM0
1 GB DDR2 SDRAM 800 MHz ok
BANK 1/DIMM1
1 GB DDR2 SDRAM 800 MHz ok
Bluetooth: Old - Handoff/Airdrop2 not supported
Wireless: en1: 802.11 a/b/g/n
Video Information: ℹ️
ATI Radeon HD 2600 Pro - VRAM: 256 MB
iMac 1920 x 1200
System Software: ℹ️
OS X 10.10 (14A389) - Time since boot: 23 days 18:5:35
Disk Information: ℹ️
ST3320820AS_Q disk0 : (320.07 GB)
EFI (disk0s1) <not mounted> : 210 MB
Macintosh HD (disk0s2) / : 319.21 GB (195.05 GB free)
Recovery HD (disk0s3) <not mounted> [Recovery]: 650 MB
USB Information: ℹ️
HP Officejet 6000 E609n
Apple, Inc. Keyboard Hub
Primax Electronics Apple Optical USB Mouse
Apple, Inc Apple Keyboard
Apple Inc. Built-in iSight
Western Digital External HDD 500.11 GB
My Passport (disk1s1) /Volumes/My Passport : 500.11 GB (200.60 GB free)
Apple Inc. BRCM2046 Hub
Apple Inc. Bluetooth USB Host Controller
Apple Computer, Inc. IR Receiver
Gatekeeper: ℹ️
Mac App Store and identified developers
Kernel Extensions: ℹ️
/Applications/Popcorn 4/Popcorn.app
[not loaded] com.roxio.TDIXController (2.0) [Click for support]
/System/Library/Extensions
[not loaded] com.aliph.driver.jstub (1.1.2 - SDK 10.7) [Click for support]
Problem System Launch Agents: ℹ️
[killed] com.apple.accountsd.plist
[killed] com.apple.AirPlayUIAgent.plist
[killed] com.apple.bird.plist
[killed] com.apple.CalendarAgent.plist
[killed] com.apple.CallHistoryPluginHelper.plist
[killed] com.apple.CallHistorySyncHelper.plist
[killed] com.apple.cloudd.plist
[killed] com.apple.cmfsyncagent.plist
[killed] com.apple.coreservices.appleid.authentication.plist
[killed] com.apple.coreservices.uiagent.plist
[killed] com.apple.EscrowSecurityAlert.plist
[killed] com.apple.nsurlsessiond.plist
[killed] com.apple.pluginkit.pkd.plist
[killed] com.apple.printtool.agent.plist
[killed] com.apple.rcd.plist
[killed] com.apple.recentsd.plist
[killed] com.apple.sbd.plist
[killed] com.apple.scopedbookmarkagent.xpc.plist
[killed] com.apple.secd.plist
[killed] com.apple.security.cloudkeychainproxy.plist
[killed] com.apple.spindump_agent.plist
[killed] com.apple.telephonyutilities.callservicesd.plist
22 processes killed due to memory pressure
Problem System Launch Daemons: ℹ️
[killed] com.apple.AssetCacheLocatorService.plist
[killed] com.apple.awdd.plist
[killed] com.apple.ctkd.plist
[killed] com.apple.diagnosticd.plist
[killed] com.apple.emond.aslmanager.plist
[killed] com.apple.GSSCred.plist
[killed] com.apple.icloud.findmydeviced.plist
[killed] com.apple.ifdreader.plist
[killed] com.apple.nehelper.plist
[killed] com.apple.nsurlsessiond.plist
[killed] com.apple.periodic-daily.plist
[killed] com.apple.periodic-monthly.plist
[killed] com.apple.periodic-weekly.plist
[killed] com.apple.softwareupdate_download_service.plist
[killed] com.apple.softwareupdated.plist
[killed] com.apple.spindump.plist
[killed] com.apple.tccd.system.plist
[killed] com.apple.wdhelper.plist
[killed] com.apple.xpc.smd.plist
[killed] org.cups.cupsd.plist
20 processes killed due to memory pressure
Launch Daemons: ℹ️
[loaded] com.adobe.fpsaud.plist [Click for support]
[loaded] com.sonos.smbbump.plist [Click for support]
User Login Items: ℹ️
iTunesHelper UNKNOWN Hidden (missing value)
Jawbone Updater Application (/Applications/Jawbone Updater.app)
Dropbox Application (/Applications/Dropbox.app)
Internet Plug-ins: ℹ️
Photo Center Plugin: Version: Photo Center Plugin 1.1.2.2 [Click for support]
FlashPlayer-10.6: Version: 16.0.0.305 - SDK 10.6 [Click for support]
Default Browser: Version: 600 - SDK 10.10
Flash Player: Version: 16.0.0.305 - SDK 10.6 [Click for support]
QuickTime Plugin: Version: 7.7.3
OfficeLiveBrowserPlugin: Version: 12.3.6 [Click for support]
CitrixICAClientPlugIn: Version: 11.2.0 [Click for support]
iPhotoPhotocast: Version: 7.0
3rd Party Preference Panes: ℹ️
Citrix Online Plug-in [Click for support]
Flash Player [Click for support]
UE Smart Radio [Click for support]
Time Machine: ℹ️
Auto backup: YES
Volumes being backed up:
Macintosh HD: Disk size: 319.21 GB Disk used: 124.16 GB
Destinations:
Time Machine Backups [Local]
Total size: 3.00 TB
Total number of backups: 98
Oldest backup: 2013-08-28 05:45:36 +0000
Last backup: 2014-12-30 19:39:32 +0000
Size of backup disk: Excellent
Backup size 3.00 TB > (Disk size 319.21 GB X 3)
Top Processes by CPU: ℹ️
5% com.apple.WebKit.Plugin.64
3% WindowServer
2% sysmond
0% AppleSpell
0% com.apple.WebKit.Networking
Top Processes by Memory: ℹ️
41 MB Finder
41 MB iTunes
37 MB Safari
32 MB com.apple.WebKit.Plugin.64
32 MB mds
Virtual Memory Information: ℹ️
53 MB Free RAM
501 MB Active RAM
463 MB Inactive RAM
398 MB Wired RAM
78.46 GB Page-ins
3.04 GB Page-outs
Diagnostics Information: ℹ️
Mar 7, 2015, 12:41:34 PM /Library/Logs/DiagnosticReports/Inkjet4_2015-03-07-124134_[redacted].crash
Mar 5, 2015, 07:42:29 PM /Library/Logs/DiagnosticReports/com.apple.WebKit.WebContent_2015-03-05-194229_[ redacted].crashThat certainly looks like a low memory issue, 2 GB ram is barely enough to run Mac OS X versions from Lion through Yosemite. The high number of Page Outs and killed processes show very high memory pressure.
Try adding memory, but be sure it is high quality, Mac certified memory such as that from OWC, http://www.macsales.com or Crucial, http://www.crucial.com -
I would like to save the WMF file with proper dimensions as they are in the editor (my saved WMFs have the dimensions of my screen resolution). They come from a RichEdit.
Thanks.
Edit:
My goal is to convert the images that appear on a RichEdit to another format.
Here is the fragment of the RTF:
{\pict\wmetafile8\picw7407\pich9259\picwgoal4199\pichgoal5249
010009000003703e020000005a3e02000000050000000b0200000000050000000c022b24ef1c5a
ffffffffffffff030000000000
}\cf2\lang1033\b\f1\fs23\par
For each 2 chars in this string I converted it to hex and saved it through a memory stream. Then I opened it in Paint or GIMP and there is the image. I even can convert it to a PNG file through ImageMagick tool. But the dimensions are wrong. How to fix
this?
I am using Lazarus.
I could guess that the header is not OK, but how they can be opened by Paint and converted? So I guess the dimensions info is wrong in the header. In GIMP even the dimensions are right, here a link to the GIMP's dialogbox confirmation with the dimensions
it has encountered in the file ( http://s13.postimg.org/s536tgo9z/Metafile_in_GIMP.png ).
So the info is there, but is wrong. When I open the images in Paint, they are wrong. Microsoft Office Picture Manager can also open them correctly, but could not convert them so. I need to do it programmatically. TMetafile Delphi class could not open these
files as well in order to be converted. So I could only edit the bytes.
My RichEdit WMF data can not be accepted by ComputeAldusChecksum routine nor get a handle from SetWinMetaFileBits API call, which would convert it to an EMF format.
procedure TMetafile.ReadWMFStream(Stream: TStream; Length: Longint);
var
WMF: TMetafileHeader;
BitMem: Pointer;
MFP: TMetaFilePict;
begin
NewImage;
Stream.Read(WMF, SizeOf(WMF));
if (WMF.Key <> WMFKEY) or (ComputeAldusChecksum(WMF) <> WMF.CheckSum) then
raise EComponentError.Create('Invalid metafile.'); // <<<<<<<<<<<<<<< exception here
Dec(Length, SizeOf(WMF));
GetMem(Bitmem, Length);
with FImage do
try
Stream.Read(BitMem^, Length);
FImage.FInch := WMF.Inch;
if WMF.Inch = 0 then
WMF.Inch := 96;
FWidth := MulDiv(WMF.Box.Right - WMF.Box.Left,25400,WMF.Inch);
FHeight := MulDiv(WMF.Box.Bottom - WMF.Box.Top,25400,WMF.Inch);
with MFP do
begin
MM := MM_ANISOTROPIC;
xExt := 0;
yExt := 0;
hmf := 0;
end;
FHandle := SetWinMetaFileBits(Length, BitMem, 0, MFP);
if FHandle = 0 then
raise EComponentError.Create('Invalid metafile.'); // <<<<<<<<<<<<<< exception here
Enhanced := False;
finally
Freemem(BitMem, Length);
end;
end;Hi Antônio G,
Based on your description, I’m afraid that it is not the correct forum for this issue, since this forum is to discuss:
Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor.
To make this issue clearly, would you mind letting us know more information about this issue? Which language are you using? Which kind of app are you developing?
Reference:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/a9e1857d-dd5b-443b-8633-397aea6e7b8c/help-on-properly-handling-wmf-mmanisotropic-image-in-rtf-file-when-extracted?forum=csharpgeneral
https://social.msdn.microsoft.com/Forums/vstudio/en-US/5b99d331-ef56-4d60-bf12-3e3b70783376/how-to-convert-a-hex-string-save-in-a-rtf-file-into-an-image-jpg-or-bmp?forum=csharpgeneral#a9219408-f73b-4e98-a9d8-7a1e0f20cdd9
Maybe you could select the language development forum for this kind of issue. If not, please let me know more information about it, I will help you find a more appropriate forum.
Best Regards,
Jack
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Converting a Hex String to an Int
I have a quick question. I am attempting to encode an Integer as a Hex String using Integer.toHexString(), which produces a max of eight hex characters.
I then need to convert this string back to an integer. I tried using Integer.parseInt(string, 16), but this only works for positive integers, because it expects a negative number to be designated with a "-" sign, which is the behavior of Integer.toString(int, 16).
I do not wish to represent the "-" sign in that manner, because I want to minimize the length of the hex string.
This method is time-critical, and I would like it to be as simple as possible, so I am looking for a solution in the standard libraries. Does anybody know of a method to convert the eight character hex representation which includes the sign bit as part of the eighth character back to an int using a method provided by the libraries?int intVal = (int)Long.parseLong(str, 16);
-
How could I choose some bytes from HEX string and then convert it to a decimal value?
Hi I am working with an OMRON E5EN temperature controller using VISA serial to get data, I send the Read from Variable Area command and get this string in hexa 0230 3130 3030 3030 3130 3130 3030 3030 3030 3030 3041 3203 71 or .01000001010000000000A2.q in ASCII this string means:
02 STX
3031 3030 Node and subadress
3030 End Code Normal Completion
3031 3031 Command Read from Variable Area
3030 3030 respt code Normal completion
3030 3030 3030 4132 Hexadecimal A2 = 162 (this is the temperature data that I want to show in decimal)
03 ETX
71 Block Check Character
I want to choose the eight bytes for the temperature data and convert it to a decimal number. I have seen the examples to convert a Hexa string to decimal but I do not know how to choose the specifics bytes that I need.
I have look for a driver but i didn´t find any. I am a beginner so please include especific topics for me to study in your answer.
Thanks
Carlos Fuentes Silva Queretaro MexicoIf the response always has the temperature starting with byte 15 and is always 8 bytes in length, you can use the String Subset function to get those bytes out of the string. Then use Hex String to Number to convert to a decimal number.
Well someone already beat me to the solution:
Message Edited by tbob on 01-04-2008 04:42 PM
- tbob
Inventor of the WORM Global
Attachments:
HexStr2Decimal.png 7 KB -
Non-hex character in hex string after upgrade to Yosemite
Hi,
When I try to open some of my files I get an error: "Acrobat PDF File Format is having difficulties. Non-hex character in a hex string". I could open the files before.
The only thing I've done since I opened the file last was to upgrade to Yosemite. The error occurs on both my Mac Pro (late 2013) and Mac Book Pro with Yosemite. Unfortunately, I have no access to a Mac with Mavericks and CS6 but I will try to fix one to verify that the file works there.
Affected files (Created in Illustrator CS6 on Mavericks):
services.ai
visual guidelines v.0.4.pdf
visual guidelines.ai
Tested steps:
Open previous versions of the same file from our repository
Update Illustrator CS6 to latest version
Download Illustrator CC
Tried to Place the file into another file (same error)
Tried to repair file Enable content recovery mode | Illustrator CS2-CS5Hi svepdesigncenter,
How you are accessing those files from your repository?
There might be chances of getting files corrupted when transferring.
File may have been sent as ascii when it should have been sent as binary or vice versa.
In 99% of transfers it's ALWAYS safest to zip an AI or eps file before sending it anywhere.
Regards,
Sumit Singh -
Non-hex character in a hex string error message
Hi everyone,
I encountered n error message in Illustrator "Acrobat PDF File Format is having difficulties. Non-hex character in a hex string." when trying to open a particular file.
File was originally created on a Windows 7 PC, tried opening file on Mac OS 10.7.5, same Illustrator version 18. Also tried opening in PDF, Distiller, but didn't help.
Did tried to change Illustrator Preferences in both Windows and Mac, following the steps in the TecNote:
http://kb2.adobe.com/cps/500/cpsid_50031.html
When trying to open the file from the File > Open menu, with the keys held down, it did not open a blank file window, neither did it created a duplicate copy in the Finder where the file is located.
The file in question had about 15 artboards, a few embedded images, approx 2.6MB size.
Any suggestions/assistance would be greatly appreciated.
Thank you.Hi Monika,
The file was .ai file, as mentioned earlier, was created in Illustrator ver 18.
Not emailed, stored in the folder, on the Windows PC, not a server. Last saved few days ago, tried to reopen the file from the same computer, but could no longer opened.
No, Illustrator did not crash, just the error message "Acrobat PDF File Format is having difficulties. Non-hex character in a hex string." -
Non-hex character in a hex string
My Illustrator file will not open in Illustrator and I get the "non-hex character in a hex string" window whenever I try to open it. It does open in Acrobat but nothing else. I can't even save it as a pdf file..
Is there any way I can get around that or fix it?karam,
The first thing to try is to use File>Place in a new document and see how much, if anything, is saved this way.
The next thing to try is to repair the file code, which is more difficult. The basics are told in this TechNote, the actual recovery consists of changing/adding/deleting code.
http://kb2.adobe.com/cps/500/cpsid_50031.html -
Hex String of format "01:02:03:04:05:06" to Integer?
Yes, that is a Mac Address,
does anyone know if there is some "comfortable" conversion routine in Cocoa for converting Hex numbers from String to int?
The ":" could be stripped, of course, they are only delimiters for easier reading...
Many thanks for any suggestions!
Cheers,
ThomasAfter you strip the colons from the string try something like:
NSScanner *scan = [NSScanner scannerWithString:hexValue];
unsigned val;
[scan scanHexInt:&val];
'val' will now contain the integer value of the string. 'hexValue' is the hex string. You might need to prepend "0x" to the start of the string too, after removing the colons.
Maybe you are looking for
-
VIs for using UNIX pipes?
We're going to start working on an application that will eventually run on a UNIX machine, but in the meantime we'll develop on NT, which is what we're familiar with. One requirement is to communicate with another process through a UNIX pipe. Are the
-
HT4858 how do i see what photos i have saved onto my icloud it wont let me look
how do i find what pictures i have saved onto my icloud??
-
Approval Authorization Template
Hi All, We are trying to set an approval by invoice line item. We want approval authorization when the quantity of specified inventory items are not between ranges identified per each item in user defined fields. The approval authorization only wor
-
Is there a special way to store and access audiobooks? I've set mine up at files inside my music folder, under a playlist with the book title, but it's awkward to get to. There also doesn't seem to be any way to mark my place so I'll know where to st
-
How I gather statistics via OEM db control?
Hi, According to the documentation, I may setup a job to automatically gather statistics for all the segments in my database via EM database control. I cant find any documentation on how to do this. I did find a link in EM which will allow me to gath