Cannot jump into ADC's VIC (LPC2129,2138 on MCB2100 board)
2005-10-04 by Jürgen Zollner
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:
Show quoted textHide quoted text
>#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