K
K
Klaxons2020-09-06 21:41:21
ARM
Klaxons, 2020-09-06 21:41:21

How to read system tick value on stm8s003?

I need to count the timestamp between two events (change of logical zero to one and vice versa), events occur quickly, on the order of 400 and 800 microseconds, respectively, high accuracy is needed. At first I wanted to do it on a timer, with a microsecond interrupt, but for this MK this is too little and it constantly reboots. I thought, read the value of systick, anyway the MK is clocked and this counter is somewhere, but I can’t find where? I would also like to know which register is responsible for this, because I don’t use SPL, but I do everything on registers and compile sdcc. In general, I want to get an analogue of the Arduino function micros () - a function that returns the number of microseconds from the start of the program (power on)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2020-09-09
@jcmvbkbc

I thought, read the value of systick, anyway the MK is clocked and this counter is somewhere, but I can’t find where?

You can set the timer so that it does not cause interrupts, and at the right time to read the value of the timer counter -- TIMx_CNTRH/ TIMx_CNTRL.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question