Jump to content

Hi need help to design and output PWM via serial port


kriss2fer

Recommended Posts

Hi i am extremely new to labview.just started for the past 2 months. I am still learning and quite unfamiliar with it still. I want to know how to output a PWM via serial port using labview. I have looked at the examples but don reallt undertsand how it works. it would be nice if i could design one myself to show a better undertsanding of it. I do want to learn how to use labview well. thanks

Link to comment

Hi Kriss2fer:

Welcome to the forum.

I hope we can help. It sounds from your question as if you are a student working on a homework assignment. (Forgive me if I misunderstand. :) ) Usually, for that kind of question we only give general clues , or perhaps more detailed help if you've worked the problem enough yourself to have a very specific question about something.

That said, its up to us individual members to give what answers we feel are appropriate. Since you've asked politely, and since you profess a desire to learn about LabView yourself, here are some clues. There are two commands that might be helpful for making a PWM output through the serial port:

The Wait (ms) command will allow your program to wait a specified number of milliseconds. During this time, the output of the serial port will be inactive (higher voltage).

The VISA Serial Break.vi will send a break message of a specified number of milliseconds (but no more than 500). During this time, the port output will be active (lower voltage).

By setting these items into a sequence to force one to follow the other, and by putting the sequence within a loop, with a little simple math to adjust the relative number of milliseconds in each state, you should be able to make a crude, but for some purposes useful and efffective, PWM output on the serial port. Configure and select serial port before the loop, release port after loop exits. Be sure to wire the error cluster to all the vi's that have them-- this helps a lot in debugging.

A good preliminary step would be to hook up a scope to the output of the serial port, and make sure you can see the output change as you send out messages-- You might want to test that using Hyperterm, a LabView serial output example, or some other simple serial port communications program, just to be sure you have the hardware hooked up right, so you can then focus on your programming problem knowing you have the tools you need to test your work.

Hope these clues get you started.

Best Regards, Louis

Link to comment
But I cant seem to find the wait comand. can it be found in the express palete?

:thumbup: Aha! now we're getting somewhere!

If you really want to learn LabView, or for that matter if you already know it and want to do something useful, get rid of the express palette.

Tool Menu>Options...(way down at the bottom)>Pulldown choice "Control/Functions Palette"> Select Advanced view.

Then, when you use the functions palette, Time & Dialog>Wait ms (wristwatch looking thing, second item on the subpallete.)

In general, the Express Vi's are useful for three purposes (1)doing very simple routine things, (2) as convenient example vi's that you can pick apart and modify if you already know LabView, but want to try doing something different from what you've done before, and (3)(perhaps most important) As a marketing tool for NI so they can claim you don't have to be a programmer to use LabView-- Very true, but in that case, don't try and do anything anywhere near as unusual as using a serial port for a PWM output.

Best Regards, Good Luck, and keep us posted on your progress! :thumbup:

Louis

Link to comment
:thumbup: Aha! now we're getting somewhere!

If you really want to learn LabView, or for that matter if you already know it and want to do something useful, get rid of the express palette.

<snip>

Louis

I have to disagree. If you move from the Express Palette, you will have to basically start over. The Getting Started Manual is written with Express in mind so everything you have been exposed to is Express. This is part of smoothing the learning curve that NI has done a great deal of work on. Louis is already on top of the hill, so to speak, so he does not see the need for the simpler Express VIs and is recommending the more powerful classic subVIs. For someone who is just learning, you need a mixture. From the Express Palette you can get to the more classic VIs as well, so I would not recommend changing the palette just yet. It won't be long before you realize that you use more things from the classic palettes than Express VIs, and when you notice it, that is when I would change (I would guess 2-3 weeks of fairly constant use or 6 months of a small project here or there)

That being said, there is an Express VI that does what you are looking for. Execution Control -> Time Delay. The time is in seconds, but it has milisecond resolution and under the hood uses the Wait that Louis is recommending.

Hope that helps,

Bob Young

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.