[En-Nut-Discussion] Ethernut 5 - Linux/NutOS Counter

Ole Reinhardt ole.reinhardt at embedded-it.de
Mon Jun 27 13:47:31 CEST 2011


Hello,

> I am currently designing a electricity meter with a web server. I am
> using ethernut 5 for that. I just want to know if it is possible to
> have a counter in Linux checking for impulses on a port. The data I am
> getting are pulses from a relay. each pulse is a "1". I want to be able
> to count these and then calculate the used electricity. Each pulse
> means 0.5wh

That's quite simple. You might want to take a look to the Linux Kernel
GPIO documentation:

http://www.kernel.org/doc/Documentation/gpio.txt

If the you enabled GPIO User space access in the kernel config you can
now access any free GPIO pin via "/sys/class/gpio"

With NutOS it's as simple... Take a look to the portdio.c sample
application. There the port access is outlined for different boards. Not
yet for the Ethernut5, but you can reffer to the AT91SAM9260_EK
implementation which would be quite similar.

If you need any further support with Linux, please let me know.

Bye,

Ole


-- 

Thermotemp GmbH, Embedded-IT

Embedded Hard-/ Software and Open Source Development, 
Integration and Consulting

http://www.embedded-it.de

Geschäftsstelle Siegen - Steinstraße 67 - D-57072 Siegen - 
tel +49 (0)271 5513597, +49 (0)271-73681 - fax +49 (0)271 736 97

Hauptsitz - Hademarscher Weg 7 - 13503 Berlin
Tel +49 (0)30 4315205 - Fax +49 (0)30 43665002
Geschäftsführer: Jörg Friedrichs, Ole Reinhardt
Handelsregister Berlin Charlottenburg HRB 45978 UstID DE 156329280 




More information about the En-Nut-Discussion mailing list