[futurebasic] Re: Analog Thru the USB Port

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2004 : Group Archive : Group : All Groups

From: Walter Lenk <Walter_Lenk@...>
Date: Wed, 28 Apr 2004 12:44:03 -0400
Hi all -

On Sat, 24 Apr 2004 Charles Poole <pochas@...> wrote:

>  I would like to provide a TTL level analog signal to external device by
>  sending data through a USB port then converting  to analog.  What hardware
>  interface might accomplish this economically and how would I go about
>  setting up a software interface with an FB program?
>  I have a pressure sensor, a PIC microprocessor, and a LCD display hooked up
>  and working.
>  I now need to simulate a variety of time-varying pressure profiles to debug
>  the micro program.
>  The micro  program was  developed on  a Windows machine using Microchip
>  software but the software can't supply the realistically varying inputs that
>  I need.
>  If anyone has had to deal with this, I would sure like some help as trying
>  to become a USB
>  driver expert would be a show-stopper for me.

Robert Covington suggested the 'IO-Warrior' as a possibility, and 
from looking at the data sheet this looks to be a neat device.  Since 
I'm not sure how to talk to it from FB, and since it would need the 
addition of a DA convertor, I would probably go in a slightly 
different direction.

Since even an inexpensive ($2) PIC such as the 16F627 includes a 
USART and a PWM output, I would use one of these along with a USB to 
serial convertor such as the Keyspan USA28X. The serial support in FB 
works well, and the PICs PWM output is capable of 8 to 10 bits of 
resolution, which when fed thru a suitable low pass filter provides a 
nice DC Control signal (I have done this many times). The serial 
protocol could be as simple as sending a byte out that would set the 
PWM output to that 8 bit value, and using a 4 MHz crystal for the PIC 
would produce a PWM cycle rate of 4 kHz that would call for a 400Hz 
or so LPF and produce an update rate as t least as fast as the 

I have been using PICs to implement data collection and device 
control via the MACs serial port for many years now, and FB is a 
wonderful language to write the control programs in. I also use the 
MAC to write, assemble, and load the firmware into the PIC (albeit 
under Windoze running on Virtual PC). I much appreciate this mailing 
list as source of inspiration, and also a connection to the FB 
community, and I would be happy to supply more design details if 
anyone is interested.


Walter Lenk    Cambridge Ma    617-547-7781