How to convert desimal in range 0-100 into binary 8 bit.
hi everybody..
i have a questions. i want to design pwm that contollered by labview software..in pwm duty cycle..range of duty is 0-100. how to convert in the 8 bit binary?
example
duty_cycle binary
100 00000000
99 00000010
0 11111111
If your percentage is x, then your 8-bit value would be y = (100-x)/100*256 = (100-x)*2.56.
You can convert y into binary easily enough.
EDIT: Nevermind, I just read your example again.
With having only 8 bits to play with, your percentage has to be in steps of 12.5. You could take your number and divide by 12.5. This would give how many bits are to be high.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Similar Messages
-
How to convert date format dd.mm.yy into yyyymmdd?
Hello experts,
how to convert date format dd.mm.yy into yyyymmdd?
Thanx
AxelHi
go through these previous threads on similar question
https://forums.sdn.sap.com/click.jspa?searchID=673529&messageID=1763194
Date Conversion in Flat File
converting the DATE(yyyymmdd) into MONTH(yyyymm) format
Date Format Conversion from MM.DD.YYYY to YYYYMMDD
gives clear idea
Reagrds
Kiran
Message was edited by:
ravi kiran naalla -
Anyone know how to convert a 3D sphere .STL file into a .igs file?
Anyone know how to convert a 3D sphere .STL file into a .igs file?
And for what? Why? This would be kinda atrocious and awful, but weird things happen...
Mylenium -
Proc C - How to convert datetime variable in Proc C into C?
Hi,
Does anyone know how to convert a datetime variable in Pro C into C?
For Example,
Order_Table with OrderId and OrderDate fields.
How do I compare the OrderDate with the system datetime in Pro C or C?
Thank you.Maybe this will help:
http://asktom.oracle.com/~tkyte/Misc/CTime.html -
How to convert date format(mm/dd/yy) into dd-mm-yy
I want to convert date format(mm/dd/yy) into dd-mm-yy
like 12/23/06 into 23-sep-06hey, you can use SimpleDateFormat to format your date. this is sample code, maybe could help you.
class dateFormat
public static void main(String[] args)
Date now = new Date();
System.out.println("Before format : "+now);
SimpleDateFormat sdf = new SimpleDateFormat( "dd-MM-yy" );//Change your date format in here.
String display = sdf.format(now);
System.out.println("After format : "+display);
}If you already understand about my sample code, i think it's easy to make your own date format. Just modified few line of my code. -
How to convert a multi page PDF document into a single TIF file?
Hi!
We are trying to convert a multi page PDF document into a single TIF file. We are using Adobe Acrobat Standard v 9. Can it be possible?I am also looking for feedback. Although having a PDF copy of a document is wonderful, long term and efficient archival for my workplace is tif or tiff.
Very frustrating that the PDF to tiff creates a separate tiff file for each page of the multi-page PDF document. Are there any options or work-arounds? -
How should i convert any image, audio and video into binary?
I am going to prepare a Steganographer Software Using java.
I want a code to convert any Image , audio and video files into binary structure.
I am having very short time to accomlish my project, so please reply as early as possible.It's already binary.
-
How to convert oracle report in html form into excel form?
Hi friends !! I m trying to convert oracle 10g report into excel form.Its coming in excel form but not with all formats.How to solve the problem?
Hello,
Please give us more information what kind of report(s). Sample example etc.,
Sri -
How to Convert the content in BLOB field into a PDF file...
Hi,
I am having PDF files stored in BLOB column of a table in Oracle Database (11G R2).
I want to retrieve the files back and store them in hard disk. I am successful in storing the content as a file with '.doc' but if I store the file as '.pdf', adobe fails to open the file with error
Adobe Reader could not open file 'xxx.pdf' because it is either not a supported file type or because the file has been damaged (for example it was sent as an email attachment and wasn't correctly decoded)
I am using following example code to achieve my goal...
Declare
b blob;
c clob;
buffer VARCHAR2(32767);
buffer_size CONSTANT BINARY_INTEGER := 32767;
amount BINARY_INTEGER;
offset NUMBER(38);
file_handle UTL_FILE.FILE_TYPE;
begin
select blob_data into b from blobdata where id=1;
c := blob2clob(b);
file_handle := UTL_FILE.FOPEN('BLOB2FILE','my_file.pdf','w',buffer_size);
amount := buffer_size;
offset := 1;
WHILE amount >= buffer_size
LOOP
DBMS_LOB.READ(c,amount,offset,buffer);
-- buffer:=replace(buffer,chr(13),'');
offset := offset + amount;
UTL_FILE.PUT(file_handle,buffer);
UTL_FILE.FFLUSH(file_handle);
END LOOP;
UTL_FILE.FCLOSE(file_handle);
end;
create or replace FUNCTION BLOB2CLOB ( p_blob IN BLOB ) RETURN CLOB
-- typecasts BLOB to CLOB (binary conversion)
IS
|| Purpose : To Convert a BLOB File to CLOB File
|| INPUT : BLOB File
|| OUTPUT : CLOB File
|| History: MB V5.0 24.09.2007 RCMS00318572 Initial version
ln_file_check NUMBER;
ln_file_size NUMBER;
v_text_file CLOB;
v_binary_file BLOB;
v_dest_offset INTEGER := 1;
v_src_offset INTEGER := 1;
v_warning INTEGER;
lv_data CLOB;
ln_length NUMBER;
csid VARCHAR2(100) := DBMS_LOB.DEFAULT_CSID;
V_LANG_CONTEXT NUMBER := DBMS_LOB.DEFAULT_LANG_CTX;
BEGIN
DBMS_LOB.createtemporary (v_text_file, TRUE);
SELECT dbms_lob.getlength(p_blob) INTO ln_file_size FROM DUAL;
DBMS_LOB.converttoclob (v_text_file, p_blob, ln_file_size, v_dest_offset, v_src_offset, 0, v_lang_context, v_warning);
SELECT dbms_lob.getlength(v_text_file) INTO ln_length FROM DUAL;
RETURN v_text_file;
END;user755667 wrote:
Hi,
I am having PDF files stored in BLOB column of a table in Oracle Database (11G R2).
I want to retrieve the files back and store them in hard disk. I am successful in storing the content as a file with '.doc' but if I store the file as '.pdf', adobe fails to open the file with error
Adobe Reader could not open file 'xxx.pdf' because it is either not a supported file type or because the file has been damaged (for example it was sent as an email attachment and wasn't correctly decoded)
I am using following example code to achieve my goal...
Declare
b blob;
c clob;
buffer VARCHAR2(32767);
buffer_size CONSTANT BINARY_INTEGER := 32767;
amount BINARY_INTEGER;
offset NUMBER(38);
file_handle UTL_FILE.FILE_TYPE;
begin
select blob_data into b from blobdata where id=1;
c := blob2clob(b);
file_handle := UTL_FILE.FOPEN('BLOB2FILE','my_file.pdf','w',buffer_size);
amount := buffer_size;
offset := 1;
WHILE amount >= buffer_size
LOOP
DBMS_LOB.READ(c,amount,offset,buffer);
-- buffer:=replace(buffer,chr(13),'');
offset := offset + amount;
UTL_FILE.PUT(file_handle,buffer);
UTL_FILE.FFLUSH(file_handle);
END LOOP;
UTL_FILE.FCLOSE(file_handle);
end;
create or replace FUNCTION BLOB2CLOB ( p_blob IN BLOB ) RETURN CLOB
-- typecasts BLOB to CLOB (binary conversion)
IS
|| Purpose : To Convert a BLOB File to CLOB File
|| INPUT : BLOB File
|| OUTPUT : CLOB File
|| History: MB V5.0 24.09.2007 RCMS00318572 Initial version
ln_file_check NUMBER;
ln_file_size NUMBER;
v_text_file CLOB;
v_binary_file BLOB;
v_dest_offset INTEGER := 1;
v_src_offset INTEGER := 1;
v_warning INTEGER;
lv_data CLOB;
ln_length NUMBER;
csid VARCHAR2(100) := DBMS_LOB.DEFAULT_CSID;
V_LANG_CONTEXT NUMBER := DBMS_LOB.DEFAULT_LANG_CTX;
BEGIN
DBMS_LOB.createtemporary (v_text_file, TRUE);
SELECT dbms_lob.getlength(p_blob) INTO ln_file_size FROM DUAL;
DBMS_LOB.converttoclob (v_text_file, p_blob, ln_file_size, v_dest_offset, v_src_offset, 0, v_lang_context, v_warning);
SELECT dbms_lob.getlength(v_text_file) INTO ln_length FROM DUAL;
RETURN v_text_file;
END;I skimmed this and stopped reading when i saw the BLOB to CLOB function.
You can't convert binary data into character based data.
So very likely this is your problem. -
I am obtaining data from a camera and getting 10-bit data in Labview. I want to convert the element values to binary and then join adjacent elements to create an array half the size of the original.
Hi cowboy,
well 640×480 is not exactly half of 680×480×2...
- You have to read the specs of your camera. Then you should know how to combine the values.
- When you get 10bit values you probably need I16 datatype to store the values. Unless you also decrease the color resolution to 8 bit you are still stuck to 640×480×2 byte per image...
- To join numbers you should have a look at the numerics->data manipulation function palette
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
How to convert a table exists in db into an ore.frame object ?
Hi:
I can get the "ore.frame "object that is returned by ore.ls() while have created by ore.create(),but I want to make a table in db as "ore.frame" object and I can operate it in R console.But how?
thanks very much.Let's say you have a table <tt>FOO</tt> in the same schema that you used to <tt>ore.connect</tt> to. To get it as an <tt>ore.frame</tt> object:
ore.sync(table = "FOO")
ore.attach() -
How to convert an XML file (input data) into a SOAP message?
Hi there,
I recently wrote a dummy program to retrieve data from a web service. The program simply read from an input file (the xml content) and send it to the web service, the return result is store in a file (xml). I wish to 'upgrade' this approach of reading and writing from/to a file and have it done by SOAP. For some reason, I'm unable to do so.
The data on the xml input file that I sent is this:
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<Upgrade xmlns="http://tempuri.org/">
<upgrade>
<User>John</User>
<Password>javalava</Password>
<EmployeeId>77384</EmployeeId>
<Rank>Q6</Rank>
</upgrade>
</Upgrade>
</soap12:Body>
</soap12:Envelope>
When trying to upgrade to SOAPEnvelope it fails.
Thanks for any pointers!!!I was trying (unsuccessfully) g to write something like this
* sorry I don't know what are the tags for <code></code>
<code>
public static SOAPMessage prepareMessage(String username, String password, String emplID) throws SOAPException
SOAPMessage soapMsg = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();
// SOAP body
String prefix = "tns";
String uri = "http://tempuri.org/Upgrade";
SOAPEnvelope envelope = soapMsg.getSOAPPart().getEnvelope();
SOAPBody body = envelope.getBody();
SOAPBodyElement service = body.addBodyElement(envelope.createName("Upgrade", prefix, uri)); //there are 2 Upgrade in the XML (Upgrade and another upgrade, but I couldn't figure out how to that here)
SOAPElement symbol = service.addChildElement(envelope.createName("User", prefix, uri));
symbol.addTextNode(username);
symbol = service.addChildElement(envelope.createName("Password", prefix, uri));
symbol.addTextNode(password);
symbol = service.addChildElement(envelope.createName("EmployeeId", prefix, uri));
symbol.addTextNode(emplID);
return soapMsg;
</code> -
How to convert the 3.x ABAP Routines into BI 7 ABAP Routines
Hi All,
I am trying to convert a BI 3.x data flow into BI 7 data flow suing DTP's.
But i am stuck at Transformations. We have used several Routines in 3.X data flow and those routines are not converted automatically into the new data flow.
Is there any other tool or program whcih will convert the ABAP routines automatically into the new ABAP format.
my sample ABAP 3.x Code looks like this in Start routine,
LOOP AT DATA_PACKAGE.
IF ( DATA_PACKAGE-CPPVLC EQ 0
AND DATA_PACKAGE-CPPVOC EQ 0
AND DATA_PACKAGE-CPSTLC EQ 0
AND DATA_PACKAGE-CPQUAOU EQ 0
AND DATA_PACKAGE-CPSVLC EQ 0 ).
DELETE DATA_PACKAGE.
CONTINUE.
ENDIF.
I tried to replace DATA_PACKAGE with SOURCE_PACKAGE, but it did not work.
any help will be appreciated.
Cheers
POPSI tried to replace DATA_PACKAGE with SOURCE_PACKAGE, but it did not work.
When you use SOURCE_PACKAGE it will not have header line so you need to use workarea.
Use something like
LOOP AT SOURCE_PACKAGE into WA_SOURCE_PACKAGE.
Define WA_SOURCE_PACKAGE of type SOURCE_PACKAGE.
and replace further data_package in the code with WA_SOURCE_PACKAGE
Hope this helps.
Edited by: Praveen G on Jan 27, 2009 4:10 AM -
How to convert information of a job posting into a xml string or file
hi hr experts,
I hope to find some answers.
Is there a function in the ERP system that converts all the information of a job posting into a xml string or file?
This could be used to communicate with external job databases, e.g. monster or jobpilot.
The function CALL TRANSFORMATION converts data to XML. Is this really the only way to convert the job posting?
Thanks for your feedback and help.
Ralf von Seht
Edited by: Ralf von Seht on Mar 26, 2008 4:45 PM
Edited by: Ralf von Seht on Mar 26, 2008 4:46 PMHi Elena,
The issue is caused by XSLT is not script enabled by default. Please provide XsltSettings in the loading to fix the issue. For more information, please see:
http://daomingworks.wordpress.com/2009/12/11/xslt-transform-data-error-use-the-xsltsettings-enablescript-property-to-enable-it/
Thanks,
Jinchun Chen
Jinchun Chen
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff AT microsoft.com(Please replace AT with @) -
How to convert the String "1+1==2" into the boolean true?
Hi folks!
I need your help...
In a Java program, I have a String such as
String str="1+1==2";
and I want to know if the content of this String is true or not.
How to get the answer in a boolean b?
I already know that
boolean b=Boolean.valueOf(str).booleanValue();
doesn't work (b contains false);
whereas when I try
boolean b=Boolean.valueOf("true").booleanValue();
it perfectly works (b is true).
Would you be so kind as to solve my problem?
Thanks ;)
Tropoufreferring to the original poster...
Hi folks!
I need your help...
In a Java program, I have a String such as
String str="1+1==2";
and I want to know if the content of this String is true or not.
How to get the answer in a boolean b?How can the content of a String ever be a boolean ? and we all know that one...
If he were to revise his orginal requirement things would not be so
difficult for him.
"1+1==2" and "2*12-2*10==2" have one thing in common. They both check if the
RHS is equal to 2 or not...and THAT is a boolean.
And if that is a String it takes no genius to figure out how to
get a number out of them.
What's the problem with getting his boolean result.
Maybe you are looking for
-
Why does my Safari shut down every time I open a PDF attachment?
I recently installed the new version of safari beta 3.0.2 and whenever I try to open an attachment without downloading it to my desk top first Safari close's all windows and supposedly sends an error message to apple. how do I fix this? Do i change a
-
Official developer documentation isn't clear about this. Apple Push Notification Service includes a default Quality of Service (QoS) component that performs a store-and-forward function. If APNs attempts to deliver a notification but the device is
-
Unable to create Target Element error
Hi Experts, I have Source and taget messages as below: Target Structure MT_Table---- 1:1 Row-- 0..unbound -Field1-- 1.1 -Field2-- 1.1 -Field3-- 1.1 -Field4-- 1.1 Source is IDOC ZMaterial---- 1.1 IDOC-- 1.1 -Begin-- Req ---EDIDC40 Segement
-
Wikiserver strips out links with question marks
Since installing a fresh copy of yosemite and server 4, I've noticed the wiki server no longer allows links with question marks. This makes it impossible to create links that are based on tags eg https://myserver/wiki/find?tags=mytag I also use the w
-
I notice this most frequently in Photoshop - the keyboard stops responding to keyboard commands (e.g. "m" to select marquee tool does not work, command-spacebar to select zoom tool does not work). All I have to do is to quit Firefox and they work aga