Pulse Width Modulation using visual basic

Thread Starter

Spogpean

Joined Feb 5, 2008
8
hi all,

im trying to impliment PWM control of a heating element using visual basic, but have come unstuck. i cannot find ANYTHING on the net about it. would anyone have any kind of source code that i could use?

regards
 

beenthere

Joined Apr 20, 2004
15,819
You may have a hard time with VB. It does not have those nice old PEEK and POKE functions that allow low-level hardware access. It will take a different language like Power Basic or X Basic, or else in-line assembler to let you do PWM.

What port or interface were you going to use?
 

SgtWookie

Joined Jul 17, 2007
22,230
I wouldn't try to do PWM straight from Visual Basic. Timing would vary widely depending upon events outside of program control.

But you could use it to communicate with a microcontroller that's actually performing the PWM.
 

Thread Starter

Spogpean

Joined Feb 5, 2008
8
Thanks for the replys sos far lads. So could I build a PWM Circuit, and then use the VB to see the signals generated on a graph or something?

I need to see the PWM signal on the screen, how would I go about doin that?

Thanks!
 

thingmaker3

Joined May 16, 2005
5,083
If your frequency is low enough, you can buy or build one of the PC oscilloscopes. If your frequency is to high for that, you might have to get creative with your serial port and software other than VB.
 

Ian_McCrum

Joined Mar 9, 2008
1
You could get VB to generate PWM - since you are driving a heating element then the TIMER activeX control could output a waveform that is high and low, say over 1/10th of a second. You set the interval of the timer to the number of milliseconds you want - it is probably only accurate to a millisecond (I think there is a way of getting more accuracy).

Certainly when I use the timer in animation I do not notice any "Jerkiness"

Presumably for your project you need to sense temperature and output an on-off signal. The input and output will be harder than getting PWM. Sounds like you could use the parallel port for that... any more details?

Ian McCrum
IJ.McCrum@ulster.ac.uk

__
 
Top