1

I have made a sensor that produces a 4 bit output. I want to perform some logic based on patterns.

I was thinking if somehow I could give that 4 bit input to my computer, I could then write code to perform logic. But, the problem is, I have no idea how to do this.

How can I give a 4 bit input to the computer? Can I use USB or some other hardware?

Phil Frost
  • 56,804
  • 17
  • 141
  • 262
Divanshu
  • 195
  • 3

1 Answers1

1

You can use any IO port available on your computer. PCI(e), USB, Ethernet, parallel ports, RS-232, PS/2, game port, Firewire...you could use any of them, provided they are fast enough for the rate of data you must transfer.

If you want easy, the parallel port is the way to go. These are trivial to interface to TTL. Though, they are quite uncommon these days.

RS-232 is also pretty easy. You can use MAX232 to generate the +/- 12V signaling, and a UART (included in most microcontrollers) to build circuitry that speaks RS-232. Serial ports are also becoming quite uncommon. One solution is to use a USB <-> RS-232 IC like those made by FTDI, either by including one of their ICs in your circuit, or buying a pre-made cable with the FTDI IC included. This is how the Arduino implements its "USB" connection.

You can also use the RS-232 control lines as a bit-bang interface if you don't need high speeds.

There are also any number of data acquisition peripherals. Some have PCIe interfaces and are extremely fast and expensive. Some cost a few dollars on eBay and may have a USB interface. Without knowing more about your requirements it's impossible to make a specific recommendation.

Phil Frost
  • 56,804
  • 17
  • 141
  • 262