I've made more progress, but still not working.
Chris, please send me your example, I'm gonna use a 1232 part
with direct ADC soon enough..
Chris Liechti wrote:
Kelly Murray wrote:
Steve, I do have the x1xx family user guide.
slaa049c.pdf?
It turns out the CA1 does not have .5*VCC,
but is really just what a 10k resistor will do to 3v...
kind of depends on the circuit ;-)
I thought perhaps the .5*vcc trigger was not meet,
I changed to .25*Vcc, but still no interrupt, and still 1.6v on CA1.
I want to use C instead of assembly, and have tried to figure out
adapt the two assembly code examples, I must be failing somewhere..
it's a good plan to use C :-)
Here is the setup assembly from the example (fet110_ca_temp1.S)
SetupCA: mov.b #CARSEL+CAREF0+CAON,&CACTL1 ; -Comp = 0.25*Vcc
on mov.b #P2CA0,&CACTL2 ; +Comp =
P2.3
SetupTA: mov.w #TASSEL1+TACLR,&TACTL ; SMCLK, clear TAR
eint ; Enable interrupts
Here is my corresponding C code (but I use CA1 instead of CA0)
note that CA1 is the inverted input of the comparator. that means that
the comparator output is inverted too.
CACTL1 = CARSEL | CAREF_025 | CAIE | CAON; // -neg, Ref is
.25*Vcc, interrupts, enable
CACTL2 = P2CA1 | CAF; // Select CA1 +pos, and Filter
TACTL = TASSEL_SMCLK | TACLR | TAIE; // TimerA uses SMCLK, clear
TAR, interrupts
you dont realy want to set CARSEL as that selects the reference to be on
the pin that you use as input.
you dont need the interrupt from the comparator, as you use the timer to
measure the signal, dont set CAIE.
your timer does not yet run, set MC1 to start it in continous mode.
TAIE is probably not needed as that is the timer overflow interrupt and
has nothing to do with the capture/compare modules.
but setting CCTL1 to CAP|CCIE, select the compararor as source and
select the appropriate edge will greatly improve the chances of getting
an interrupt ;-)
Here is a question, is putting this code below sufficient to
have the Compare interrupt handler defined?
The assembly defines it as
.section .vectors
.org 0x10,0xFF ; Timer_AX Vector
.word TAX_ISR ;
// Timer A0 interrupt service routine
interrupt (TIMERA0_VECTOR)
atimer(void)
{
trigger = 1;
}
you realy want TIMERA1_VECTOR as the comparator is wired to the
CCR1/CCTL1 capture/compare module, and when implementing TIMERA1_VECTOR,
dont forget to read TAIV to acknowledge the interrupt.
then, dont forget to declare the variable as volatile as it's used from
the forground as well as interrupts, e.g.:
volatile int trigger = 0;
i have a slope adc measurent function that i can provide as an example,
but its on an other machine, so you'll have to wait for next week if
you're interested.
chris
Steve Underwood wrote:
Hi Kelly,
I don't think you have described what you are doing in enough detail
for me to make much sense of what you said. What is Timer A doing,
and at what time do you see 1/2 rail on the CA1 pin?
The 11x1 user guide is just the datasheet. The real detail about the
peripherals is in the MSP430x1xx family user;s guide (slau049d).
Regards,
Steve
Kelly Murray wrote:
Hi Steve,
It did look like there are two inputs, thanks for confirmation.
I do have a 11x1 user guide.
When I run the program, I don't get a timer_A interrupt,
the CA1 terminal has a 1.5v on it (.5*VCC), that doesn't seem
to make sense, it should have 3.0V on it once the cap charges,
which is as far as my code goes as yet.
Steve Underwood wrote:
Hi Kelly,
I think Fig 16-1 in the MSP430x1xx family user's guide (slau049d)
is pretty explicit. It shows there are genuinely two comparator
inputs, and the register bits you need to control to make use of
them. Do you have that document, or are you struggling with just
the datasheet for the 1121 itself? You really must have that user's
guide to understand most of the peripherals properly.
Regards,
Steve
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users