Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Pulse counter over serial port (was RS232)



Kalin KOZHUHAROV kirjoitti 18.4.2011 kello 12.54:
> Hello Henri,
> Thank you for the info.
> On Mon, Apr 18, 2011 at 11:55, Henri Servomaa <r_muffin@example.com> wrote:
>> Kalin KOZHUHAROV kirjoitti 18.4.2011 kello 11.37:
>>> On Mon, Apr 18, 2011 at 07:00, Henri Servomaa <r_muffin@example.com> wrote:
>>>> Kalin KOZHUHAROV kirjoitti 18.4.2011 kello 3.21:
>>>>> As part of a DIY Geiger counter logging backend, I'd like to read
>>>>> properly formatted pulses over RS232 on my box (and later on my
>>>>> Gumstix).
>>>> 
>>>> Do you mean there's no data protocol, but you just want to read some data value(s) ?
>>>> 
>>> No data protocol, just a 5V pulse/count across two wires, random in
>>> time. Usually it is about 100 counts per minute (cpm), but with
>>> radiation sources it grows to a few thousand. The software needs to
>>> sample say every 10 seconds and see how many counts were there during
>>> that time.
>> 
>> Aha.. can you tell me how it's wired? Or point me to HW docs?
>> 
> No docs yet :-|
> 
> ----------------< GND  (pin 5 on DB-9 female)
> -------||-------< RD     (pin 2 on DB-9 female)
>       0.01uF

Hi Kalin,

So, above you are describing something you've made...

> Yep, that is correct, I should have said "Pulse counter over serial port".
> According to the description in the code, his geiger was wired like:
> *
> * RM-60     RS-232     DB-25
> * Ground    SG         7
> * Signal    RI         22       [goes low when an event occurs]
> * Positive  DTR        20
> * Negative  RTS        4

And this is someone else's device&source code?

> So I guess, I can try to rewire it tonight. But if I can change the
> software, it will be easier (we are getting quite a good deal on
> cables wired this way and they are hot glue fixed). My unit gives a
> +5V pulse when event occurs though, so I might need to invert (ouch!)
> the signal in hardware...
> Any ideas?

Basically there's 2 ways you can read data from the serial source:
Polling or using an interrupt.

The polling would be easier to start with. What you can do is write a busyloop and do something when there's a status change in either
the RI or RD pins (or any other, for that matter)

Using interrupts is how the "real stuff"(TM) is done, because you let the HW tell you when something happens, so it's more reliable and
doesn't take up your cpu. But, in Linux you need to make a kernel driver for this.

Have a look at these for some details about the registers etc used for the serial port.

http://www.easysw.com/~mike/serial/serial.html#5_1_1
http://www.beyondlogic.org/serial/serial.htm#12

An alternative is to use a parallel port, but that seems to be contrary to what you want to achieve(?)

This project intrigues me, I'd love to understand a bit more.

Cheers,
Henri

> 
> Kalin.
> 
> -- 
> To unsubscribe from this mailing list, 
> please see the instructions at http://lists.tlug.jp/list.html
> 
> The TLUG mailing list is hosted by the award-winning Internet provider
> ASAHI Net.
> Visit ASAHI Net's English-language Web page: http://asahi-net.jp/en/



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links