Noob question about interrupt rates

Hi I’m trying to determine if an Arduino Duemilanove board will work for my design.
I have a data bus with a ttl signal where a bit position is 0.1 mS long, along with a 12v power bus. There is no synchronising clock.

I would like to create a stream of bits representing the bus data to feed a host computer ( netbook probably) over USB or serial.

I was planning to use the two interrupt pins to create a down and an up interrupt. The interrupt routines would then cause a timer to run for 101 uS. This would allow me to detect bit boundaries and bit sense data. So the absolute maximum interrupt rate would be 10KHz.

The ATmega168 clock rate is 16MHz giving me 1600 clocks to get the work done. Assuming 3 clocks per instruction - say about 500 instructions per data bit. I need to start and stop a clock, set and reset interrupts, organise the data and ship it out on USB or serial.

Do the on chip timers run at the cpu clock rate?

Do you think there are enough instructions per bit to do the work and is the estimate reasonable?

Id like to power the board straight from the 12 Bus (possibly via a filter) but Im not clear what the practical power limits are (5 - 20v is stated).

Thanks for any comments

Pete

Hi Pete, welcome to Arduino.

Although you describe it as a data bus, it sounds like you want to decode a serial data stream. Could you clarify what you mean by : “a data bus with a ttl signal where a bit position is 0.1 mS long”

If it is a serial stream you want to decode, bits spaced at 0.1ms intervals is a rate of 10000 baud and that is well within the capability of some of the software serial libraries produced for arduino. Have a look at the source code for Mikal Hart’s NewSoftSerial here: http://sundial.org/arduino/?page_id=61

Hi,
Thanks for the comments. Sorry for the delay; you have made me think some more about the problem.

I’m building a listener; so yes the data is a serial stream at 10 kHz as viewed from the listener. The data is exchanged between units on a common connection (actually its a physical star). The wiring also includes a 12v supply. The component on the bus are about 3 meters apart. I want to be able to apply some CPU grunt to the data stream to try and decode it.

I have just tried a Maxim 232 on the problem. I’m not sure how the device will be able to synch up with the data stream; for example how can it convert a 0.2 mS low into two '0’s in its 232 output. There doesn’t seem to be anyway to set the bit rate on the device so it cant be running a synchronising clock. I think it just does level conversion,

This is why I’m looking at a uController solution.

A second solution would be to create a 10KHz clock and use an interrupt to lock the clock to the data stream. Then use an A/D converter to sample the data stream (delayed) from the clock.

Thanks for any comments. I think Ill try out the Duemilanove board just because of its low cost :slight_smile: I can try both solutions.

Pete

On a similar vein… what is the shortest pulse that can be expected to trigger the interrupt?

if_man, you can do the level conversion with a transistor and few resistors – something like R5,R6 and T1 in the circuit here: http://webzone.k3.mah.se/k3dacu/arduino/releases/serial_v1/arduino_serial_v1.png

You connect the input to R5, almost any NPN transistor will do and you don’t need the diode if your signal does not go negative. The collector of T1 goes to a digital input pin.

I would look at the way NewSoftSerial decodes a serial stream for the software side, but you will need to figure out how your data stream indicates the end of a packet.

what is the shortest pulse that can be expected to trigger the interrupt?

the interrupt is edge triggered so it can be as short as you want as long as you allow enough time between pulses to do what you need. What is it you want to do?

mem,
thanks for the link. Have ordered my board; I will try out different approaches and feed back what happens.

Pete