Counter Module question?
msiriwardena
Posts: 301
I am trying to understand Counter module applications.I am reading through "Propeller Education Kit Labs" and in P 123 :
Counter Modules and Circuit Applicaions Lab Page 123
3) Store 1 in the FRQ register so that the phsa register will get 1 added to it for every clock tick
that P17 is high:
frqa := 1
1 isnt the only useful FRQ register value. Other FRQ register values can also be used to prescale the
sensor input for calculations or even for actuator outputs. For example, FRQ can instead be set to
clkfreq/1_000_000 to count the decay time in microseconds.
frqa := clkfreq/1_000_000
What I don't understand is if "frqa" is added to "phsa" every "clock tick" The interval between the each add is "one clock tick" but you are adding "clkfreq/1_000_000"
every "clock tick".
To get decay time in mocroseconds: - then you have to add 1 microsecond every microsecond to "phsa" to get the decay time in microseconds.
Do I make sense.??? or I am confused ??
Please explain clearly.
Thanks,
Siri
Counter Modules and Circuit Applicaions Lab Page 123
3) Store 1 in the FRQ register so that the phsa register will get 1 added to it for every clock tick
that P17 is high:
frqa := 1
1 isnt the only useful FRQ register value. Other FRQ register values can also be used to prescale the
sensor input for calculations or even for actuator outputs. For example, FRQ can instead be set to
clkfreq/1_000_000 to count the decay time in microseconds.
frqa := clkfreq/1_000_000
What I don't understand is if "frqa" is added to "phsa" every "clock tick" The interval between the each add is "one clock tick" but you are adding "clkfreq/1_000_000"
every "clock tick".
To get decay time in mocroseconds: - then you have to add 1 microsecond every microsecond to "phsa" to get the decay time in microseconds.
Do I make sense.??? or I am confused ??
Please explain clearly.
Thanks,
Siri
Comments
The way to solve this is to take the total count, when frqa == 1, and divide it by clkfreq / 1_000_000 after the fact.
-Phil
I understand : when frqa:= 1 1 is added to phsa every clock tick
When FRQA is set to ---> frqa := clkfreq/1_000_000 - what is added to "phsa" every clock tick
Please can you clarify this.
Thanks ,
Siri
-Phil
Thanks - Now I understand clearly.
Siri