Numeric to hex conversion
Hi
i am new to labview. i have implemented a controller circuit and serially communicating with using lab view in that i am using a numeric value and converting it to hex using numeric to hex string and receiving that on port 1 of controller but that is displaying ASCII values of my number though i have converted it in hex in block diagram of labview.
Attachments:
serial comm.vi 16 KB
Hi
I have problem in labview to my hardware communication. when i am using (testing) code for my controller and using CS100FULL.vi then i get whatever data i send on assigned ports. But i want total 12 bit data to deal with and thats to in hex form insted of ASCII so i do the necessary changes in controller code(testing1) and making change in vi also keeping width of decimal to hex string conversion block 3. but i wont get any data at port.
Please please suggest me whwrw i am making mistakes because in keil this code runs properly and i get at desired data at ports in simulator but when i am loding it in controller it won't work with labview but when i am using hyper terminal it communicate properly and i get data at port 0&1 that
means i am doing mistake in vi so please suggest me solution and mistakes i am making in my vi.
Thank you
Attachments:
testing.txt 2 KB
testing1.txt 1 KB
CS100Full.vi 37 KB
Similar Messages
-
Interger to hex conversion ???
Hi
Is there a easy way to make interger (unsigned 32 bit ) to HEX
conversion ??Kristian,
It depends on what you want to do with the hex conversion. To view a
number in hex in a control, right click on the control, select Format &
Precision. As long as the format is set to numeric, you can select
between decimal, hex, octal and binary from the other drop-down list.
If you want to change an unsigned 32-bit number to a hex value to be
written to a file, you can use the String->Format Into String VI. Wire
your U32 into input 1, and set the format string to %4x (which will show
a 4 digit hex value). The output will be a string which contains the
hex value.
Hope that helped.
Mark
In article <[email protected]>,
[email protected] wrote:
>
>
> Hi
>
> Is there a easy way to make interger (unsigned 32 bit ) to H
EX
> conversion ??
>
Sent via Deja.com http://www.deja.com/
Before you buy. -
Hello Friends,
I have to convert Numeric to String to send in MODBUS Communication. I dono the conversion so that numeric can be made variable and i will do conversion internally. Pls have a look at the VI attached to get clear idea. If you still have doubt in this I am ready to explain.
Thanks and Regards,
Ratheendiranaath B.R.
Solved!
Go to Solution.
Attachments:
Query.vi 6 KBHi friend,
- "to/from hex conversion" is ask very often in the forum. Did you read any of those threads?
- You also don't give clear explanations: In your example you convert your input 12 to a string displaying "12" in hex mode. Do you really want to have BCD numbers in the string? Or do you expect "0C" as string (in hex display mode)?
- using DBLs to convert to string is also ambigous. Do you wnat the value converted to some integer format or do you want to typecast the DBL?
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
DECIMAL = HEX CONVERSION PACKAGE 생성 SCRIPT
제품 : SQL*PLUS
작성날짜 : 2002-04-12
DECIMAL <=> HEX CONVERSION PACKAGE 생성 SCRIPT
==============================================
Purpose
Oracle내에서는 여러가지 값을 HEX 값으로 보여주는 경우가 있다.
이런 경우 DB내에서 decimal 값으로 변환하기 위한 방법을 알아보자.
Explanation
다음은 decimal <=> hexa 의 conversion을 위한 package 생성문으로서
system user로 수행하여 사용한다.
create or replace package support as
function dectohex (a number) return varchar2;
pragma restrict_references
(dectohex, WNDS, WNPS, RNDS, RNPS);
function hextodec (a varchar2) return number;
pragma restrict_references
(hextodec, WNDS, WNPS, RNDS, RNPS);
end support;
create or replace package body support as
FUNCTION hextodec(a IN VARCHAR2) RETURN NUMBER IS
x NUMBER := 0;
y NUMBER;
z VARCHAR2(1);
BEGIN
IF length(a) > 8 THEN
RAISE invalid_number;
END IF;
FOR i IN 1..length(a) LOOP
z := upper(substr(a,i,1));
IF z = 'A' THEN
y := 10;
ELSIF z = 'B' THEN
y := 11;
ELSIF z = 'C' THEN
y := 12;
ELSIF z = 'D' THEN
y := 13;
ELSIF z = 'E' THEN
y := 14;
ELSIF z = 'F' THEN
y := 15;
ELSE
y := to_number(z,9);
END IF;
x := x * 16;
x := x + y;
END LOOP;
RETURN x;
END hextodec;
FUNCTION dectohex(a IN NUMBER) RETURN VARCHAR2 IS
x VARCHAR2(8) := '';
y VARCHAR2(1);
z NUMBER;
w NUMBER;
BEGIN
IF a > power(2,32) OR a < 0 THEN
RAISE invalid_number;
END IF;
w := a;
WHILE w > 0 LOOP
z := w mod 16;
IF z = 10 THEN
y := 'A';
ELSIF z = 11 THEN
y := 'B';
ELSIF z = 12 THEN
y := 'C';
ELSIF z = 13 THEN
y := 'D';
ELSIF z = 14 THEN
y := 'E';
ELSIF z = 15 THEN
y := 'F';
ELSE
y := to_char(z);
END IF;
w := trunc(w / 16);
x := concat(y,x);
END LOOP;
RETURN x;
END dectohex;
END support;
drop public synonym support;
create public synonym support for system.support;
grant execute on support to public;FYI: The new xf86-video-intel (2.9) has just been released:
http://article.gmane.org/gmane.comp.fre … xorg/40733
According to the release announcement, the new driver fixes the backlight issue with KMS:
* Add support for BACKLIGHT property when using kernel modesetting
(KMS). This allows backlight adjustment with programs such as
"xbacklight -set <percentage>" or "xrandr --set BACKLIGHT <value>". -
Hi,
How can i convert character into hex string , for example if i have the data as "testing data", how can i get the hex coded output? Ive tried out using first string to number vi and thennumber to hex conversion vi but i get the answer as 0, can u help me in this?
In short my data is " testing1234okokok" , i want a hex coded output which would be something as "AD87BA......."
Please help
From SubhashWhat coercion dots? There are no coercion dots even without the loop:
Message Edited by smercurio_fc on 02-13-2008 03:12 PM
Attachments:
Example_VI.png 1 KB -
Problem with EPC URI to Hex conversion
Hi Forum,
I am getting strange EPC URI to hex conversion result in tx:/ain/http_test . Could you please confirm if this result is not expected.
1.URI : urn:autoid:tag:sgtin-96:3.0066800.054321.70
hex is : 30740413C00000D431000000
2.URI: URN:AUTOID:TAG:SGTIN-96:3.0066800.054321.71
hex is: 30740413C00000D431000000
thus is both case HEX is same!!!
i am using EPC_1.24 as active EPC version.
could you please suggest some round about way.
thanks in advance,
regards,
Ashithi,
i think problem is with EPC_1.24. i changed to
EPC_1.27
and it works fine.
regards,
Ashit -
I simply wish to take several numbers (controls) multiply them together but then I need the answer to be converted into the form of a string (ascii).
Is there a VI available to do this ??Hi sammy,
Right-click on the diagram and have a look around the String functions palette - specifically the String/Numeric conversion functions.
Cheers.
"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare) -
Application A has a data type NUMBER and B has a data type BLOB. The data types cannot be changed since we don't have the source codes for both applications.
The data stored in application A is a float of negative value (--1.7029176). I need to convert it to hex (BFD9F934) and store it in application B to be able to use it.
Is there a way to code this in PL/SQL?I guess you are looking for these conversion functions
SQL> select rawtohex(-1.7029176) from dual;
RAWTOHEX(-1.70
3E641F48542966
--" or "
SQL> select dump (-1.7029176,16 ) from dual;
DUMP(-1.7029176,16)
Typ=2 Len=7: 3e,64,1f,48,54,29,66 -
Hex conversion problem... Please help
Hi all,
I need to convert a hex character representing a UTF-16 character to a hex string representing a UTF-8 character
i.e
String input ="0x0630"; //ARABIC LETTER THAL (UTF-16)
I want the output to be a hex representation of the same charcter in UTF-8.
Does anyone know the java code to do this?As BIJ001 already implied: There are no "UTF-8 characters" and "UTF-16 characters". There are Unicode characters and their respective UTF-8 and UTF-16 encodings.
For example:
"ذ" is the arabic Letter Thal. Its name in the Unicode standard is ARABIC LETTER THAL. Its is the Unicode codepoint (decimal) 1584. This is often written as U+0630 (note that this number is hexadecimal).
The UTF-16 encoding of this letter is the 16bit word 0x0630 (the UTF-16 encoding of most common characters is identical to its codepoint, but that's not always the case!).
The UTF-8 encoding of this letter are the two 8bit words 0xD8 0xB0.
If you have the String "0x0630", then you can split the hexadecimal number from the String, parse it, interpret it as a char, and create a String from it. Then call getBytes("UTF-8") on it and you'll have a byte array containing the UTF-8 encoding of that character.
[_The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)_|http://www.joelonsoftware.com/articles/Unicode.html] is a nice explanation as well. -
Need Hex conversion to char for 4 digits.
I need to read a file in and translate some of the characters into integers. I need the hex value from the character. Problem is, when using Cp850 which is the encoding of the file, some characters show as ? instead of the proper character.
A simple output shows the problem where only 4 digit hex values will not appear correctly. You can view the character set and values at the following URL http://www.microsoft.com/globaldev/reference/oem/850.htm
Here is a simple app to show the problem.
public class EncodingTest {
public static void main(String[] args) throws Exception {
String encoding = "Cp850"; //args[ 0 ];
byte[] b = new byte[256];
for (int i = 0; i < 256; i++)
b[i] = (byte)i;
byte c[] = new byte[1];
String x = new String(b, encoding);
for (int i = 0; i < x.length(); i++) {
c[0] = b;
if (x.charAt(i) != i)
System.out.println(i + " -> " + (int)x.charAt(i) + "->" + (new String(c, encoding)));
How to I get character 176 for example to show correctly? I tried to post the output from the app but all of the characters showed as ?.Well, if you want to convert int or char values to hex, just do the following:
Integer.toHexString(int value);
Now, about your charset problem, I tried it and found out that you will definetly not be able to print strange characters in DOS.
I'll show you my example, it might help you; it prints out good in my computer...
public class EncodingTest {
public static void main(String[] args) throws Exception {
String encoding = "Cp850"; //args[ 0 ];
byte[] b = new byte[256];
for (int i = 0; i < 256; i++)
b[i] = (byte) i;
byte c[] = new byte[1];
String x = new String(b, encoding);
for (int i = 0; i < x.length(); i++) {
c[0] = b;
if (x.charAt(i) != i)
System.out.println(i + " -> " + Integer.toHexString((int)x.charAt(i)) + "-> " + (int)x.charAt(i) + "->" + (char) i + "->" + (new String(c, encoding))); -
Guys, I look at ASCII table given to me for Czech chars and hex value for character "á" is E1. But when I use rawtohex function to get hex value I get below output.
WHY ?
SQL> select rawtohex('á') from dual;
C3A1
How can I get value E1 ? ThanksMy Oracle version is
Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
PL/SQL Release 9.2.0.1.0 - Production
CORE 9.2.0.1.0 Production
TNS for Solaris: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production
NLS settings are ---
1* select * from v$nls_parameters
SQL> /
PARAMETER VALUE
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_CHARACTERSET EE8ISO8859P2
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXF
F AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXF
F AM TZR
NLS_DUAL_CURRENCY $
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
Anything more I need to setup. Btw I dun understand yet very clearly difference between NLS_CHARACTER_SET and NLS_NCHAR_CHARACTERSET -
Hello, can anyone please tell me how to achieve the same effect on this website, http://mylanguages.org/converter.php , in pl sql or oracle sql? They have taken an arabic string and returned a (to my knowledge) hex value.
Many ThanksHandle: igwe
Status Level: Newbie (15)
Registered: Mar 11, 2008
Total Posts: 384
Total Questions: 148 (83 unresolved) Do you ask so many difficult questions or don't you mark questions as answerd when they are?
with inp as
( select 'سليم' str from dual
union all select 'anton' from dual
select ( select listagg( '&#' || to_number( utl_raw.substr( utl_i18n.string_to_raw( str, 'AL16UTF16' ), level * 2 - 1, 2 ), 'XXXX' ) || ';' ) within group ( order by level )
from dual
connect by level <= length( str )
from inpEdited by: ascheffer on Mar 5, 2013 11:33 PM -
Numeric to character conversion
How to convert the numeric to character format? give me function module.
Hi,
please check out the below program it will help you
REPORT ZSPELL.
TABLES SPELL.
DATA : T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.
DATA : PAMOUNT LIKE SPELL-NUMBER VALUE '1234510'.
SY-TITLE = 'SPELLING NUMBER'.
PERFORM SPELL_AMOUNT USING PAMOUNT 'USD'.
WRITE: 'NUMBERS', T_SPELL-WORD, 'DECIMALS ', T_SPELL-DECWORD.
FORM SPELL_AMOUNT USING PWRBTR PWAERS.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = PAMOUNT
CURRENCY = PWAERS
FILLER = SPACE
LANGUAGE = 'E'
IMPORTING
IN_WORDS = T_SPELL
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3.
ENDFORM. " SPELL_AMOUNT
***********please reward points if the information is helpful to you******************* -
i want to convert hex-file to text file. can anyone help
ThanksWin the yes need the no to win again the no.Congratulations.Is this some euro thing?
>
@Scarlet: I'm currently at some IBM building. They
have a few showcases here in the hallways, and one
shows an acoustic memory. I didn't really grasp how
it works, though. But it can store 8 KB (IIRC) on
just the size of a copier paper package.
The acoustic memory is a serial access memory, you convert the 1s and 0s to audio bleeps and send it down some kind of medium to slow it down, recover it later in time allowing to read and write and then retransmit, pipes of mercury were a common medium. This is back in the days of vacuum tubes, the processor would have a small amount of 'fast' memory made of tubes (two per bit) -
Good morning,
I need advice please - we have obtained a piece of code from another SAP customer as we urgently had to use a formula to generate some data.
ws_seedno = '123456789ABCDEF123456789ABCDEF12'.
ws_length = STRLEN( ws_seedno ).
ASSIGN ws_seedno(ws_length) TO <fs> TYPE 'X'.
MOVE <fs> TO ws_khex.
The first step is to convert a seed number to hexadecimal - the customer that gave us the code obtains this result out of that code :
3132333435 3637383941 4243444546 3132333435 3637383941 4243444546
3132000000 0000000000 0000000000 0000000000 0000000000 0000000000 00000000
we on the other hand get this result :
0031003200 3300340035 0036003700 3800390041 0042004300 4400450046
0031003200 3300340035 0036003700 3800390041 0042004300 4400450046 00310032
Would someone know why the results differ? We are on different SPs and operating systems but both are ECC6,
Any advice would be greatly appreciated.
AnetteThank-you Jay and Vishal,
Unfortunately both the suggested solutions delivers the same result as the code I posted
0031003200 3300340035 0036003700 3800390041 0042004300 4400450046
0031003200 3300340035 0036003700 3800390041 0042004300 4400450046 00310032
what is VERY interesting is that the person that supplied us the code is on ECC5, we also have an ECC5 SAP HR installation and this supplies the correct string :
3132333435 3637383941 4243444546 3132333435 3637383941 4243444546
3132000000 0000000000 0000000000 0000000000 0000000000 0000000000 00000000
This does not seem to be an ABAP issue - quite possible a basis?
Anette
Maybe you are looking for
-
Numbers document - could not be opened
I have my family budget spreadsheet that I use daily. I only have one copy. I went to open today and it has come up with The document "xxx.numbers" could not be opened. I can preview the document. I can see it as an attachement on my iphone and view
-
When I try to delete page(s) from a PDF document I created, I geth the following message: "One or more pages are in use and could not be deleted." Any suggestions?
-
The display on my MacBook Air has recently started flashing. Are there any fixes that I might try before sending it in for repair?
-
How do i get my macbook to stay connected to my wireless network . i have to constantly rejoin it when i go online. Wayne
-
Fixed Array help!!!
i have a fixed array colection....how do i return the highest value in the array....but i need it to return its position in the array i have the running loop working to return the highest value in my array but i need it to store the position it is in