I am using an FTDIchip which is the FT245R, i was able to connect and write to the device. And the aim to be able to creat PWM on any of the Data PINs and control it with a Trackbar. I have tried writing 1's and 0's to create that but have not control of the PIN
How Do i Control PWM with Trackbar for a Pin in Visual Basic
Apr 17, 2012
17 Replies
Good.
From Visual Basic you'll going to be restricted to relatively low output frequencies and the precision of the PWM is going to be affected by whatever else is running on your system... but if you're just hooking the PWM outputs to LEDs or heaters or something, it should be OK.
Eh? I'm not sure what you mean here?
Do you mean that you can't turn the pin on and off at all, even slowly?
This is probably a programming or driver issue. Getting this sort of basic functionality is often the most frustrating part of a project.
My liberal friends think I'm a conservative kook.
My conservative friends think I'm a liberal kook.
Why am I not happy that they have found common ground?
Tim Wescott, Communications, Control, Circuits & Software
http://www.wescottdesign.com
Yes i mean writing couple of 0"s and 1's in a continuous loop to create PWM
Joey,
I think you do not understand that USB is NOT deterministic.
A USB device can not create timing of any kind.
A program writes to a USB driver, when the USB driver is called by the operating system, one or more messages will get delivered.
USB does not understand time, only packets of data.
You can not do what you are asking to do.
hamilton
By the way, which VB version are you using to do this ?
hamilton
"Can not do" may be a bit strong.
"Can't run it very fast" is certainly correct, though. PWM frequencies for an oven can run down into the millihertz; you could certainly do that in a PC.
An FTDI sending serial commands to a microprocessor that's generating a PWM signal -- that would work, at far far higher speeds than bit-banging PWM from a PC ever could.
My liberal friends think I'm a conservative kook.
My conservative friends think I'm a liberal kook.
Why am I not happy that they have found common ground?
Tim Wescott, Communications, Control, Circuits & Software
http://www.wescottdesign.com
You picked the wrong device to do that with.
You need to talk to a stand alone device that will do that for you.
Look into PIC from microchip.com or ATmel that carries the Avr Tiny or megas..
The USB system does not allow for real time in windows.
Jamie
OK, I'll admit 1 hertz PWM is still PWM, but lets get real.
At 1 hertz, it the next edge is .1 second off thats not a problem.
But at even 10 hertz, .1 sec is an entire cycle lost.
Why even discuss this at this level, it can not be done, so go do it right.
I do like the idea of a USB PWM controller.
Even in Visual Basic, if you "own" the machine (i.e., you boost your own priority and make sure there aren't any other long-running high-priority processes that are likely to run), 10Hz is likely viable, USB non-determinism and all.
I wouldn't ask for much more, though.
FTDI chips have a GPIO mode not covered by the other usb-serial chips I've not investigated further whethere this mode includes any PWM outputs
if all you have is an multitaskinn OS and a generic programming language the best you can do is one PWM channel with the step size governed by the bitratte by emitting crafted bit patterns
?? 100% natural
--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net
Get a Stellaris development kit. It includes a FTDI 2232 USB adapter, power feed from the USB and a 32 bit ARM Cortex with plenty of suitable timers. With a piece of simple code in the processor, you'll get a bunch of PWM ports controllable via a virtual serial port from the PC.
Tauno Voipio
the smaller TI MSP430 lauchpad is a bargain, USD 4.30 with free international shipping.
(they ask not to use the kit itself for production devices, but for play or education it's fine. it seems like cheating to use the programming interface for a control input, but it works...)
?? 100% natural
--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net
I use these USB I/O peripherals often. They come with Visual Basic drivers and example programs and are reasonably priced:
formatting link
The FT245R could be used to communicate with another peripheral that has PWM capability.
Don't be discouraged, mistakes contain far more information than getting it right the first time.
Best, Ed
Why not use a UART (PCI or USB) to generate a PWM signal ?
If the output value is known 10-50 milliseconds in advance, the values can be precalculated and queued to the serial port and the timing only depends of the UART crystal. At 115k200 bits/s, the pulse width is about 10 us. Even if a single character can produce only 8 different values (most other are duplicates), this could still be quite usable for low frequency applications.
Of course, using 8 data bits + start bit + one stop bit, the available range is just 10 .. 90 %, but for any AC coupled systems (base line at 50 %), this would not be an issue.
You only get about 10% (~three bits) resolution, at least at the symbol rate. Just by inspection, it seems you'd pick up another bit for each doubling of symbols, so at 115kbps and a 10Hz signal, that's what, 16 bits (log2(11500/10)+3)? For very low bandwidth, with a large enough filter, it seems like an idea, though.
I completely agree, but if the alternative is to use bit banging through USB to some digital output, using some _user_ mode code on some _non_deterministic OS (such as Windows XX), executing under some kind of interpreter,:-) :-)
I still think the UART is a viable alternative.
Or serial into a PIC to a PWM port. ;-)
Actually, it's kinda cute.
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required