EmbeddedRelated.com
Forums

Re: Cannot jump into ADC's VIC (LPC2129,2138 on MCB2100 board)

Started by Aalt Lokhorst October 5, 2005
Hello Jgen

I think you need to use
VICIntEnable = 0x00040000
instead of
VICIntEnable = 0x00004000

Or even more readable if you try to set bit 18:
VICIntEnable = (1<<18);

If you don't want to rely on the default value of VICIntSelect then it is better to clear bit 18 in this register (to be sure the ADC interrupt
well be assigned to a IRQ instead of FIQ)

Just out of my head (not tested)
VICIntSelect &= ~(1<<18); // ADC interrupt is IRQ
VICVectAddr0 = (unsigned long)ISR_Handler; // set IRQ handler
VICVectCntl0 = 0x20 | 18; // use it for ADC interrupt
VICIntEnable = (1<<18); // Enable ADC interrupt

Succes,
Aalt

-- ==============================
Aalt Lokhorst
Schut Geometrische Meettechniek bv
Duinkerkenstraat 21
9723 BN Groningen
P.O. Box 5225
9700 GE Groningen
The Netherlands
Tel: +31-50-5877877
Fax: +31-50-5877899
E-mail: Lokhorst@Lokh...
==============================
Jgen Zollner wrote:
> Hi,
> > I have a software problem, certainly I missed something in my Code.
> I'm using LPC21XX (2129,2138) chips on a Keil MCB2100 board,
> relevant jumpers are set. ADC is working fine, but I want a jump
> into VIC by the DONE bit.I'm working on this task a few days and I
> lost now, perhaps you could help.
> > Kind regards
> Zollner Juergen
> > Here my simple code:
> >#include <stdio.h> // standard I/O .h-file
> >#include <LPC21xx.H> // LPC21xx definitions
> >//#include <LPC213x.H> // LPC213x definitions, AD is replaced by AD0
> >
> >
> >unsigned long value = 0xFFFFFFFF;
> >
> >// ISR Handler for ADC, set here a breakpoint in debug mode,
> >// but was never reached in flash or simulator mode
> >void ISR_Handler(void) __irq
> >{
> >value = ADDR; // dummy, read the ADDR, clear DONE
> >VICVectAddr = 0x00000000; // update register
> >}
> >
> >// initializise the ADC, in main
> >.
> >.
> >.
> >
> >// select AD0 as input on Port 0
> >PINSEL1 = 0x004000000; // [23:22] Pin P0.27 as AD0.0
> >ADCR = 0x00200301; // Channel 1,10bit, 3MHz @ 12MHz, PDN
> >
> >// enable ISR and and VIC
> >VICIntEnable = 0x00004000;
> >VICVectCntl0 = 0x00000032;
> >VICVectAddr0 = (unsigned long) ISR_Handler;
> >
> >// Loop forever
> >while (1) > >{
> >ADCR |= 0x01200000; // Start A/D Conversion
> >do
> > {
> > value = ADDR; // Read A/D Data Register
> > }
> >while ((value & 0x80000000) == 0); // Wait for DONE, jump to ISR
> >ADCR &= ~0x01000000; // Stop A/D Conversion
> >}
> >//end of main
> > > > > SPONSORED LINKS
> Microprocessor > <http://groups.yahoo.com/gads?t=ms&k=Microprocessor&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microprocessor&c=4&s&.sig=tsVC-J9hJ5qyXg0WPR0l6g> > Microcontrollers > <http://groups.yahoo.com/gads?t=ms&k=Microcontrollers&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microprocessor&c=4&s&.sig=DvJVNqC_pqRTm8Xq01nxwg> > Pic microcontrollers > <http://groups.yahoo.com/gads?t=ms&k=Pic+microcontrollers&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microprocessor&c=4&s&.sig=TpkoX4KofDJ7c6LyBvUqVQ> > > 8051 microprocessor > <http://groups.yahoo.com/gads?t=ms&k51+microprocessor&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microprocessor&c=4&s&.sig=1Ipf1Fjfbd_HVIlekkDP-A> > > > >
> >.
> > >
>



An Engineer's Guide to the LPC2100 Series