How to convert a number to duty cycle (FPGA)

Hi
I want to convert a numerical number to a duty cycle value in FPGA module so I could use it to generate a PWM signal for the numerical value.
I tried dividing it but it shows an error in FPGA as it would produce a float value. I tried even the example of scaled division but the quotient is rounded of to 0 (I wanted to convert an output by multiplying 10/36).
In my project the 100% duty cycle is 360 degrees and 0% is 0 degrees of the motor shaft rotation.
Please help me I need to use it for my project.
Thank you
Dinesh

  I am not exactly sure how your duty cycle is setup, but here is a way we have used a number to create a PWM in our FPGA.
     If you have 360 deg. then I would guess you want to create a PWM duty cycle that is some fraction of 360, say "number"/360.  You could use a for loop where 360 is wired to the "N" and then your "number" can be compared to the current loop count.  That comparison would be true/false which could triger a DIO to be high or low.  Therefor, if   (loop count) < "number"  then DIO is HIGH,  if (loop count) >= "number then DIO is LOW.   This would send out a PWM that has a duty cycle of "number"/360, (multiply by 100 to get in %)  
     I hope this helps.
 --Alex--

Similar Messages

  • Essbase 9.3 Calc scripts. Pb with dates. How to convert (string = number) ?

    Hello,
    I've a problem with Essbase(Planning?) Scripts on version 9.3. It looks simple but I do not find any (clean) solution :
    On my Essbase database, I have a member called "Reference_Date" on my axis Indicators. It is a date data type, that is to say, it displays a number corresponding to a YYYYMMDD format. For example : 20091029 for October 29th 2009.
    In calc scripts I often need to compare the month included in that "Reference_Date" with the current Member of my Time Axis (I have 12 Months members based on the format M02 for February for example). The final aim is to calculate a number of complete years since that "Reference_Date".
    But theses two elements are not of the same "type" (one is a number value and the other is a "member" in Time Axis). So I'm forced to convert one of this two elements in order to compare it.
    For example I can extract the month value of the "Reference_Date"' and put an "M" before it to have a Time member equivalent or I can convert the member Name M10 to a number (10))
    in both cases I have the same type problem : I don't know how to convert a string into a number nor how to convert a number into a string.
    (For example @CONCATENATE doesn't work with numbers). and that my only remaining problem.
    I didn't find any Essbase Function which do this (conversion number <=>string).
    Is anyone have an Idea ?
    Thanks for your help
    Best regards

    I don't know any way for you to compare your data against your metadata. Not directly. To me it makes little enough sense to try that I'm not surprised the developers didn't provide for it.
    I've converted member names to strings, manipulated the strings (calc script functions are not good at this), and turned them back into member names, but that's really the only use I've had for string manipulation. I don't think an equivalency operator even exists for string data. And I see no way to begin thinking of a member name, once converted to a string, as a number.
    It makes even less sense to me to try thinking of a data value as a string. Even text values in Sys 11 are stored as numbers. Not encoded characters, but just a number to look up somewhere.
    I think you can do what you want though, with something like this...
    IF (@ISMBR("FY08"))
    vYr = 2008;
    ELSEIF (@ISMBR("FY09"))
    vYr = 2009;
    ENDIF;
    IF (@ISMBR("M01"))
    vMth = 1;
    ELSEIF (@ISMBR("M02"))
    vMth = = 2;
    ENDIF;
    "Years_Since_Reference" = ((vYr * 100) + Mth) - ("Reference_Date" / 12);
    Obviously, the math will need some work, coz that doesn't actually work, but the logic above essentially turns your metadata into numbers, which is what you are after.
    Good luck,
    -- Joe

  • How to convert a number to FLOAT with 9 decimal values.

    Hi all,
    I need to convert a number like '10.02' to a floating point number with 9 decimal values like '10.022111221'. I think that the right function is TO_BINARY_FLOAT, but how can I obtain 9 decimal values? If I use the following syntax:
    select TO_BINARY_FLOAT(num) from table
    I obtain a floating point values with a variable number of decimal numbers after the ".", instead I need 9 number after ".".
    Regards,
    Maurizio.

    Hi,
    the number I need to select is the result of a product, for example:
    select (Num_A * Num_B) from Table;
    Num_A has 2 decimal numbers, like 12.01 and Num_B could be: 12.111111111.
    Now, Num_A * Num_B = 653.999999994
    but I issue:
    select TO_BINARY_FLOAT(54.00 * 12.111111111) from Table
    I obtain:
    654, a rounded value, but I need 653.999999994.

  • How to generate a pwm whose duty cycle has to be varied depending on the frequency of the input trigger??

    Sir/madam,
    I am quite new to the Labview FPGA module. 
    I am currently working on an application where i have to generate a pwm to control the ON time duration . The pwm ON time depends on the frequency of an input signal.I want to retrieve the ON time value from a lookup table which contain the duty cycle values for the pwm at different frequencies of the input.This input also has to work as a trigger. The input is pulsed and the trigger has to generate the pwm at every rising edge. I am using a PCI 7831R-  RIO series. I am urgently in need of some help and i have hardly a  couple of weeks before i meet the deadline.
    I am trying hard to learn the basics from the shipping examples but not able to quite make my vi work. 
    Kindly lend a helping hand and i would be very grateful to anybody who can help. Thanks a lot in advance.
    Do ask in case of any clarifications required. I  think i have explained my problem quite well. 

    Hello Manu,
    You can refer 
    Developing a PWM Interface using LabVIEW FPGA or PWM Output with LabVIEW FPGA
    How this helps.
    Best Regards, 
    Hardik Asawa
    AE
    National Instruments  
    Message Edited by Hardik Asawa on 05-05-2010 12:46 AM

  • Need Help on How to Convert a Number Field to an Hour/Minute

    Post Author: syracuse2
    CA Forum: Crystal Reports
    I have a field that shows a duration, i.e. 125.  I would like to convert the number of 125 to 2hr and 5 min.  Any suggestions on how to do this?

    Post Author: GraemeG
    CA Forum: Crystal Reports
    Create a formula and paste the following into it (sorry I use Basic Syntax):
    'Ive laboured a point here a bit so you can get an idea of what you can do.
    'Heres 3 variables - one with your duration and two others for hours and minutesshared xDuration as numbershared xHours as numbershared xMins as number
    'Put some data into the duration and calculate the hours and minutesxDuration = 125xHours =  truncate(xDuration/60)xMins = remainder(xDuration,60)
    'You can then use the variables to get a string with unformatted hours and mins'formula = xHours + "hours " + xMins + "Mins"
    'or you format the hours and minutes nicely'formula = CStr(xHours,0) + "hours " + CStr(xMins,0) + "Mins"
    'or you can make it all into one formula without the need for xHours and xMins variablesformula = CStr((truncate(xDuration/60)),0) + "hours " + CStr(remainder(xDuration,60),0) + "Mins"

  • How to convert a number stored as text to as integer with formating

    Hi,
    Can someone say me how to convert a Numeric data that is stored in a Varchar column to an integer.
    Say, I have a Value "-.84566666" in a column which is of data type VARCHAR and I want to show this data as "-0.8456", i.e. I want to display it as an Interger after formating it to have only 4 decimal place value etc.
    Is there any inbuilt function in oracle for this?
    Thanks,

    Take a look at builtin TO_NUMBER / TO_CHAR functions.
    SELECT TO_CHAR(TO_NUMBER('-.84566666'), 'SD9999')
      FROM dual;C.

  • How to convert inode number to path (for Eudora to Mail conversion)

    I've seen a header line in my Eudora client that has what I believe to be an inode number in it that represents a path:
    X-Attachments: :Server:622049:style.css:
    Server is the volume name and the 622049 appears to be the inode file system path to the folder containing the file. I want to find a programmatic way to do the conversion. For example, if in the Terminal, I issue this:
    sudo find / -inum 622049 -print
    Leopard does find the path:
    /Users/trevor/Documents/Style Sheets
    but also a whole lot of other guff such as:
    find: /dev/fd/4: Not a directory
    find: /net/localhost: Operation timed out
    The reason is that I want to do a really clean move from Eudora to Mail, but I can't any application that works well AND converts outgoing attachment paths for Mail to use. The best application application I could find does not (yet) know how to translate the inode number to a path, so that the resulting messages in Mail have the correct OUTgoing message attachments (it converts incoming attachments just fine). Hence, it's in my interest (and possibly that of all others who want a complete conversion to Mail from Eudora) to do what I can to get the Eudora to Mail process convert BOTH incoming and outgoing attachments (which, to the best of my knowledge and search, no conversion tool can do at the moment).
    Surely there is a direct, programmatic method (presumably the method used by Eudora) to get the path information. I want to send that method to the developer of the best tool I found.
    Anyone know where I can find a reference to how to prgrammatically translate the inode number to the full path, so that the e-mail converter can grab the file quickly?
    Thanks.

    Hi, Christian:
    Thank you for your message!
    i used the type cast, but it seems VISA write can not recognize it, what is the problem?

  • How to convert from number to currency format?

    Dear all,
    As use BPEL transformation or assign,
    I want to convert number format to currency foramt. (ex, 2000.00 -> 2,000.00)
    How to do this?
    Regards
    Toven.

    Hi Toven,
    Following XSL will Convert (123456789.80 -> 123,456,789.80)
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:decimal-format name="euro" decimal-separator="." grouping-separator=","/>
    <xsl:template match="/">
    <xsl:value-of select="format-number(123456789.80, '#,###.80', 'euro')"/>
    </xsl:template>
    </xsl:stylesheet>
    Output: 123,456,789.00
    Regards,
    KanmaniRajan

  • How to convert a number in to a time string?

    I have calculated a time in minutes: 3.75. But I will show it as a time string: 3:45 or 00:03:45 or anything like this.
    Yes, I can convert it manually, but then I can not use it in a diagram. I have a formula that calculates times for a given diameter and I will show the values in a diagram. The x axis should show the diameter, and the y axis should show the time in a typical time format eg: mm:ss.
    How can I solve this?

    Hello
    I just wish to add that I am unable to say:
    Engineers made a good or a wrong choice.
    They made one choice.
    I don't know if they imagine the odd consequences of this choice.
    But what they did with their choice is coherent.
    At least, it is as long we don't enter the area of import foreign sheets.
    When they import from XL, they forgot to take care of an important info available in .xls files which describes the date_time used starting point. It's 1/1/1904 for .xls docs created on Mac but an other one for docs created under Windows. Given this omission, imported date_time values may be wrong.
    When they import from AppleWorks it is completely foolish.
    You american users are well treated but us, european ones are in the mud.
    When we import an AW6 spreadsheet containing dates on a machine whose setting is the standard in use here: date format dd/mm/yyyy
    if the OS is 10.4.x we get odd values (I'm no longer born)
    if the OS is 10.5.x, Numbers quits.
    Apple engineers responded to Apple France that they where unable to reproduce the behavior.
    Sure, they failed to set the system's date format to the described one.
    This remind me an old bug which they can't reproduce too.
    It striked French keyboards but the tested with american ones.
    Sometimes I'm afraid that they smoke too much the carpet in Cupertino's offices
    Yvan KOENIG (from FRANCE jeudi 19 juin 2008 14:19:45)

  • How to optimize the number of battery cycle count?

    Hello,
    I'm using my MBP Retina display (Mid 2013 model) and I just found out my battery cycle count is 143. It's been a year since I bought it. Is that count normal? I don't use my laptop other than using it for browsing, Skype calls and word processing. I leave it charged all day and in the evening I use it up until a 60% charge is left. I can avoid this and leave it unplugged. Should I leave it unplugged and use the battery only when it is absolutely necessary to do so, to keep my battery cycle count low? Please suggest and thanks.

    Hello,
    i may be wrong but I think the number of the battery's cycle is implemented by 1 each time you recharge to 100%. Even if you were for example at 70%, when you plug the charger to reach 100% it is counted as a cycle.

  • Using labview cosimulation, how to control PWM duty cycle in multisim

    I am new to using Multisim with LabVIEW using cosimulation. I want to ask if there is a PWM component in Multisim that can have its duty cycle be controlled using LabVIEW? I have an algorithm in LabVIEW that outputs duty cycle values from 0 to 1, representing duty cycle percentages.
    How do I control the PWM duty cycle in Multisim using LabVIEW cosimulation?
    Many thanks,
    SPECTRE
    Solved!
    Go to Solution.

    Hi Spectre,
    In Multisim, search for the parts base on functionality, there are some PWM models in the database.  Have a look at this knowledge base  if you don't know how to search for parts:
    http://digital.ni.com/public.nsf/allkb/7309A5CABC677296862577ED006EC99E
    Aslo, have a look at this knowledgebase:
    http://digital.ni.com/public.nsf/allkb/EF391C48CF71AE4F862571B900644F84
    This article shows how you can get Mutlisim and LabVIEW to co-simiualte:
    http://www.ni.com/white-paper/13663/en
    I hope this helps
    Tien P.
    National Instruments

  • How to covert roman number to numeric number

    hi all
    Any idea how to convert roman number(i ii iii......) to numeric number (1 2 3.....)
    thank in advance
    Mi_D

    Hey!
    I have exactly what you need: http://bit.ly/bFRuoT
    Hope that helps!
    tomaxxi
    http://indisnip.wordpress.com/

  • Converting a number with decimal to word

    hi
    how to convert a number with decimal to words in oracle
    to_char(to_date(1311,'J'), 'JSP') giving error with number having decimal

    and very nls dependant ;-)nls-dependant because you used comma in the mask as a decimal delimiter?
    but instead of
    regexp_replace(n,'(\d*),(\d*)','\2')you can simply use:
    regexp_substr(n,'\d*$')but in case there is no fractional part it would return the whole number, but still you can avoid usind delimiter as:
    regexp_replace(n,'^\d*|(\d*)$|.','\1')PS
    of course it is not really serious, cause you can get the fractional part, without using regular expressions at all, namely: val-trunc(val)

  • How can I convert a number to char in javascript

    How can I convert a number i.e ascii number to char in javascript.
    ex: 55 to A

    How can I convert a number i.e ascii number to char in javascript.
    Quite simple: By asking in a forum that deals with javascript and not with java.
    Have no clue...
    Maybe on http://www.irt.org

  • How can I vary a PWM´s duty cycle inside a while loop?

    Hi,
    I'm using the "Generate Pulse Train.vi" to generate pwm signals in counters 0 and 1 in order to drive a DC motor both ways.
    The problem is, I need to control the movement of the dc motor with my PI controller which is inside a while loop. I've tried letting the "generate pulse train.vi" outside the while loop, but the problem is, it only changes the value of the duty cycle when the loop is stopped. I also tried putting it inside the loop, but then it doesn't even work.
    So, how can I vary a PWM´s duty cycle inside a while loop?
    I'm attaching the VI with the PI controller.
    Thanks for your help!
    Guilherme
    Attachments:
    controleValvula.vi ‏332 KB

    Here's some code I threw together a while back to change a duty cycle on the fly. It generates a fixed 5KHz or 25KHz frequency depending on laser selection, then allows duty cycle to be changed continously. Maybe you can use the premise of it for your application.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    "It’s the questions that drive us.”
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    Attachments:
    Pulse_Width_Modulator.llb ‏197 KB

Maybe you are looking for

  • Upgrade to SAP Business One 8.8 - Legal List Format

    Hi All, I am currently experimenting with the upgrade process from 2007A PL46 to SAP Business One 8.8 PL5. On some company databases that I try I get the error Legal List Format - Failed during the database upgrade process.  Does anyone know what thi

  • Switching out HD and have some questions

    I Have two different issues here. I am installing a 500Gb Seagate in my G5 which currently has a 160 Gb and a 200Gb in the two bays. The system is running on the 160Gb HD with a clone on the 200Gb. I have an external LaCie D2 500 Gb HD which I intend

  • VPN anyconnect no Ping ip firewall

    II have a management network 192.168.5.x and VPN network 192.168.25.x. I can ping a all my network elements except to firewall (ASA5510). The ASA has the IP 192.168.5.1. I think that the firewall has some restriction but I don't know. I have 8.2 soft

  • Learning SD Module

    Hi Friends, though I am ABAPer, I want to learn the SD Module. Plz help in telling the useful links where I can get gud learning documents or plz tell me how to start with the basics of SD Module. Waiting for ur replies. Nishu

  • New Smart sharpen slow updates

    The new Smart Sharpen (Photoshop CC) is very nice especially the possibility of enlarging the preview window. However the update when adjusting the sliders is quiet slow despite the fact that I have a rather powerful configuration. Anybody experience