Content originally posted in LPCWare by MarcVonWindscooting on Wed Jan 08 12:58:52 MST 2014
How can you verify the output? Oscilloscope??
Just as a coarse roadmap:
You cannot divide 12MHz by an integral divider to get 128kHz, so let's assume 127.66 kHz is fine (divide by 94). We can generate the
wanted frequency by toggling with double frequency, divider=47
So set up a match at value 47-1 (match0) disable reload.
Configure AUTOLIMIT (CONFIG).
Configure event0 as match 0, no state condition. Use state 0 only.
Configure event0 to set CTOUT_0 (OUT0SET) and event0 to clear CTOUT_0 (OUT0CLR) and resolve
by setting RES to 'toggle' in case of conflict.
Configure switch matrix. Distinguish binary numbers/decimal numbers/hexadecimal numbers properly.
If you don't understand SCT, then re-read until you do. SCT is scaring at first, after some time it turns out to be cool and easy to
understand. You cannot learn by copy-and-paste-and-askTheForum-and-paste-again. Print the SCT chapter on paper. Read.
Read again. Understand what events, states, matches, captures, outputs, intputs can be used for. Don't start programming before
you understand that.
If you prefer hope to knowledge they you had better prefer preaching to programming ;-)