need help understanding counters in Sx-48
So I am looking at incorporating the SX48 into a system, primarily because it has counters.
The only problem, is when I am reading the manual, I honestly cannot understand what it is talking about in capture/compare mode.
I feel bad, but for the life of me, I can't tell what's going on and I was wondering if somebody could help explain it to me.
Each timer has the following pins:
··· capture input 1
·· ·capture input 2
··· pwm/compare output
··· external event counter input.
Each timer has the following registers:
··· TxCPL
··· TxCPH
····TxR2CML
··· TxR2CMH
··· TxR1CML
··· TxR1CMH
····TxCNTB
····TxCNTA
Now.· I was under the impression that the Capture/Compare timer method could be used to capture analog values and be a 'rough' ADC.
The manual says a lot of things such as setting rising/falling edges on pins and comparing it to R2 and R1 registers.
Unfortunately, I am not able to connect what the manual says to how to actually implement it.
Is there anybody who can explain how to implement the counters in an ADC 'Capture/compare' type setting?
Thanks
Shaun
···
The only problem, is when I am reading the manual, I honestly cannot understand what it is talking about in capture/compare mode.
I feel bad, but for the life of me, I can't tell what's going on and I was wondering if somebody could help explain it to me.
Each timer has the following pins:
··· capture input 1
·· ·capture input 2
··· pwm/compare output
··· external event counter input.
Each timer has the following registers:
··· TxCPL
··· TxCPH
····TxR2CML
··· TxR2CMH
··· TxR1CML
··· TxR1CMH
····TxCNTB
····TxCNTA
Now.· I was under the impression that the Capture/Compare timer method could be used to capture analog values and be a 'rough' ADC.
The manual says a lot of things such as setting rising/falling edges on pins and comparing it to R2 and R1 registers.
Unfortunately, I am not able to connect what the manual says to how to actually implement it.
Is there anybody who can explain how to implement the counters in an ADC 'Capture/compare' type setting?
Thanks
Shaun
···
Comments
· The "CAPTURE" is to capture the value in the counter. It does not capture analog values, or have anything to do with ADC.
· You can use the PWM mode as a DAC though.
· CAPTURE INPUT 1: Captures (copies) the counter's current value when the input changes state
· CAPTURE INPUT 2: Captures (copies) the counter's current value when the input changes state
· PWM/COMPARE OUTPUT: Toggles the timer's output pin when the counter's value reaches T1 or T2.
· EXTERNAL EVENT: The counter's value increases when the input changes states (instead of from the hardware clock).
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Did you know that 111,111,111 multiplied by 111,111,111 equals 12345678987654321 ?
www.iElectronicDesigns.com
·
As far as an ADC:
would it break any design rules (or cause issues) to set a counter as a PWM, and have that counter incrementing (Creating a saw wave)...
And then feed that analog value into one of the comparitor inputs...and have the 'measured' analog input go into the other comparitor input?
When the interrupt from the comparitor is triggered, read the value of the Counter register?
is this idea 'too slow', or has anybody done it before?
Are there going to be any future revs of the SX Chip?· would embedding a couple of ADCs be of value?
Post Edited (Steel) : 4/23/2008 3:42:16 PM GMT
The main idea for the SX design was to create a controller which did NOT contain a bunch of hadrware peripherals. Instead, the chips were designed to operate at high speed together with a deterministic timed interrupts to allow the simulation of various peripherals just by software. IMO, this the most important feature of the SXes - they can be "tailored" to your specific needs, and this is why I like them so much.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
I have seen that idea used on the Stamp.
On the SX I would just use the ANALOGIN command.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Did you know that 111,111,111 multiplied by 111,111,111 equals 12345678987654321 ?
www.iElectronicDesigns.com
·