View previous topic :: View next topic |
Author |
Message |
malu79
Joined: 26 Jun 2011 Posts: 5
|
EX_PATG.c |
Posted: Mon Nov 21, 2011 9:33 am |
|
|
Sorry if I continue to disturb but I just have a question: ex_patg.c example, in the CCS, Code: |
//NOTE: periods MUST be multiples of 400
//Periods are in microseconds
#define PERIOD_0 400
#define PERIOD_1 800
#define PERIOD_2 1600
#define PERIOD_3 2000
#define PERIOD_4 20000
#define PERIOD_5 64000
#define PERIOD_6 2000000
|
what is it?I mean what is meant by PERIOD? |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Mon Nov 21, 2011 11:34 am |
|
|
Hi,
Generally, in the context of electronics, "period" is used to express the total time for one cycle of a particular waveform. The EX_PATG.c program generate square waves. A square wave is comprised of some "on time" and some "off time". The total of the two is the period. Frequency of the wave form is the reciprocal of the period (ie. f = 1/period).
John |
|
|
malu79
Joined: 26 Jun 2011 Posts: 5
|
|
Posted: Mon Nov 21, 2011 12:20 pm |
|
|
if I wanted to get a frequency of 1 Hz, what time should I consider? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19477
|
|
Posted: Mon Nov 21, 2011 3:34 pm |
|
|
Since the comment says 'periods are in microseconds'. 1000000. One million microseconds=1 second.
Best Wishes |
|
|
malu79
Joined: 26 Jun 2011 Posts: 5
|
|
Posted: Wed Nov 23, 2011 1:45 am |
|
|
If I can not use the period 1000000 to obtain the frequency of 1 Hz, the problem is that I can not set a correct value for the timer, the frequency increasing also because it accumulates a delay that I can not delete. |
|
|
|