Truncated match.
PICList
Thread
'32khz signal'
1999\09\23@181155
by
Kev Howard
Hello Picsters!
HELP!
I am trying to generate an approximate 32khz signal on a gpio of a 12c508/a
running at int osc.
Bsf for 1/2 cycle Bcf 1/2 cycle.
prescale 4, used but not essential! I have tried 4 x X = and subtracting
from tmro
but frequency is "miles out"
Could use lots of "nops" but that isnt learning!
Can't you tell I am new to the world of PICS, I am used to 40106 cmos and
analogue i/cs!
A subroutine of code with explanation greatly appreciated!
Kev
1999\09\23@190621
by
paulb
Kev Howard wrote:
> I am trying to generate an approximate 32khz signal on a gpio of a
> 12c508/a running at int osc.
OK, how close do you want? If the internal oscillator runs at 4 MHz
nominal, you have a 1 MHz instruction clock. A complete cycle at 32 KHz
requires 31.25 instructions, so if you approximate to 31 instructions
you get a frequency of 31,250 Hz plus or minus a few percent.
You simply need a loop of 30 instructions (including one branch which
takes two instructions) with the bit set and bit clear instructions
placed equal delays apart.
Neither TMR0 nor prescaler has any part in this, the operation is too
fast. They are appropriate for timings in the millisecond range.
--
Cheers,
Paul B.
1999\09\24@033005
by
Quentin
"Paul B. Webster VK2BZC" wrote:
> A complete cycle at 32 KHz
> requires 31.25 instructions, so if you approximate to 31 instructions
> you get a frequency of 31,250 Hz plus or minus a few percent.
>
You can do "leap" cycle. every 4th cycle you do one instruction extra.
Quentin
1999\09\27@051725
by
paulb
Hello Quentin.
> You can do "leap" cycle. every 4th cycle you do one instruction extra.
That's the sort of business I was going into earlier - another thread.
*However*, did you happen to note that he is using the internal
oscillator of the 12C508?
--
Cheers,
Paul B.
More... (looser matching)
- Last day of these posts
- In 1999
, 2000 only
- Today
- New search...