Forum: Mikrocontroller und Digitale Elektronik Input capture changing...


von Qyuip (Gast)


Angehängte Dateien:

Lesenswert?

Hi to all of you...


I am using a ATmega128 at 16Mhz. And I want to measure the time
duration of each logiclevel (1 and 0). At speeds of max 2500Hz.

To keep my problem simple for you, I want to make a pulse on evvery
edge of the input signal, so my input is on "IC1, portD,4 of the
mega128".

I want to use input capture because I need to measure the time as
aqurate as possible. (Not using INt0 and INT1 !!).

After each capture I want to change the edge detection, some fist time
rising, then falling, then rising again etc..

But the problem is that this changing of edge is not working.

please take a look at my test programm, and try to find why it's not
working.


thanks for taking you time to read me...

qyuip

von crazy horse (Gast)


Lesenswert?

C:
TCCR1B=TCCR1B^0b01000000;    toggle edge select

listing from Compiler:
in r30, 0x2e
ldi r26, low(64)
eor r30, r26
out 0x2e, r30

Basic ?

von Qyuip (Gast)


Angehängte Dateien:

Lesenswert?

thanks Crazy horse,


using the "simulate" part of my bascom I found out that cbi and sbi
for the TCCR1B register is NOT working.

NOT WORKING: ( but why not ??)
 cbi   TCCR1B,ICES1
 sbi   TCCR1B,ICES1




therefore I found also a other way of doing the job. (in attach)

I will also try your sollution !

Thanks dear horse  :-)

von crazy horse (Gast)


Lesenswert?

cbi/sbi don't work at I/O-addresses over 0x1f.

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.