LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean pulse generator

Hi everyone!

I'm trying to control a stepping motor using myRio - I need to generate a boolean pulse train with regulated frequency. I tried with creating sin function and checking (if>0) but it doesn't seem to work. Which functions should I use?

 

EDIT: I added the screen of my program.

0 Kudos
Message 1 of 13
(8,214 Views)

There are lots of ways you could accomplish this.  How about you post code that you've tried and we'll help you make it work? 🙂

0 Kudos
Message 2 of 13
(8,213 Views)

There it is:

screen_lv.PNG

0 Kudos
Message 3 of 13
(8,194 Views)

When posting code, it is expected to either use a VI Snippit or post the VI itself.  This helps us because we can actually execute the code without trying to recreate it.  It also helps see what else is going on and understand what you are trying to accomplish.

 

That having been said, I'm still unsure what you are trying to accomplish.  You are generating a square wave, then taking the very first point in that waveform and checking if it is > 0.  This is going to give you inconsistant results based on the frequency you are generating at.

 

 

I would suggest simply storing a boolean in either a shift register or feedback node, and then applying the "Not" operator to it each loop iteration.

0 Kudos
Message 4 of 13
(8,160 Views)

Voici une copie de l'écran pour ton idée.

malkheir_0-1581676572389.png

Il faut allumé le "Highlight execution" pour que tu puisses voire la pulse.

Pour plus d'information ou autre question, n'hésitez pas de me contacter.

Cordialement

Marwan ALKHEIR

0 Kudos
Message 5 of 13
(6,673 Views)

@malkheir wrote:

Voici une copie de l'écran pour ton idée.

malkheir_0-1581676572389.png

Il faut allumé le "Highlight execution" pour que tu puisses voire la pulse.

Pour plus d'information ou autre question, n'hésitez pas de me contacter.

Cordialement


Why would you add to a 4 year old english thread in french with an offtopic post and a completely crazy useless code picture full of race conditions? Are you trying to give an answer to anything in this thread or pose a new question?? Are you sure you posted in the right place?

 

Google translate to french: "Pourquoi voudriez-vous ajouter à un fil anglais de 4 ans en français avec un post offtopic et une image de code inutile complètement folle pleine de conditions de course? Essayez-vous de donner une réponse à quelque chose dans ce fil ou de poser une nouvelle question ?? Êtes-vous sûr d'avoir posté au bon endroit?"

0 Kudos
Message 6 of 13
(6,658 Views)

J'ai répondu au monsieur qui a demandé comment on crée une pulse.

1) Si ton problème est que je réponds en français, la prochaine fois je te répond en arabe.

2) Si tu n'as pas compris l'algorithme, ces ton problème, un autre gare le comprend.

3) Si tu es un peu éduqué, je t'assure que tu ne réponds pas de cette mauvaise façon.

4) Tu n'es pas la seule personne dans cette page, donc il y a un minimum de respect contre les autres.

5) Je m'en fou de ta prochaine réponse, et je souhaite que National Instruments prends les bonne décisions contre toi et s'il y a d'autres personnes comme toi.

Cordialement... 

0 Kudos
Message 7 of 13
(6,653 Views)

(I made a friendly reply. I cannot guarantee that google translate keeps the same tone)

 

Your code does not solve any problem whatsoever and makes no sense!

Sometimes, the truth hurts! Let's have a look:

 

altenbach_0-1581697787005.png

 

  • You are reading from a local (2) and writing to its terminal (1) in parallel. Most likely, (2) occurs first so the value is not predictable because it may depend on an earlier run.
  • Same for (3) and (4).
  • Your case structure does the same function as boolean to 0,1. No need for any structures
  • You are dealing with integers, no need for any orange.
  • You while loop only iterates once. Nothing would change if you would just delete it.
  • You don't have a toplevel loop. Is this a subVI? How are you calling it? Continuous run?
  • x and y are always equal after the code completes. So what's the point?

As I said, your code is highly flawed and does not solve any problem and is not guaranteed to generate any "pulse", whatever that means.

 

 

Message 8 of 13
(6,638 Views)

Bonjour monsieur, 

Si tu veux générer un signal il faut que tu passes par un 'daq' ou un 'mxdaq'.

Par contre si tu veux générer une pulse (fonction dirac) tu peux utiliser cet algorithme.

Les 'local variable' sont mis pas juste pour ce code, si tu as un grand code et tu veux mettre l'algorithme à part et la pulse à part, tu passes par ces variables.

Avant que je postule la figure, le code a été testé.

Si tu veux l'utiliser tu peux, sinon laisse tomber.

Bon weekend

0 Kudos
Message 9 of 13
(6,627 Views)

@malkheir wrote:

Bonjour monsieur, 

Si tu veux générer un signal il faut que tu passes par un 'daq' ou un 'mxdaq'.

Par contre si tu veux générer une pulse (fonction dirac) tu peux utiliser cet algorithme.

Les 'local variable' sont mis pas juste pour ce code, si tu as un grand code et tu veux mettre l'algorithme à part et la pulse à part, tu passes par ces variables.

Avant que je postule la figure, le code a été testé.

Si tu veux l'utiliser tu peux, sinon laisse tomber.

Bon weekend


No, the code is highly flawed and is not guaranteed to work because its outputs depend entirely on unpredictable race conditions. Did you even read my comments? How exactly did you test it? What was the test result?

0 Kudos
Message 10 of 13
(6,618 Views)