We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,
I'm using a STR710FZ2 uC with an external adc. When conversion is ready, the adc toggles a pin low which is connected to P1.11.
I want an interrupt to be generated on the falling edge of P1.11 so the adc value can be read.
As far as I can see I've initialised the XTI and the EIC correct, but it doesn't seem to work.
Any suggestions?
Here is some of my code.
/************************************************* ** INIT ADC *************************************************/ void init_adc(void) { config_gpio_port(PORT_1, 0x0001 << EXAD_DOUT, GPIO_INPUT_PP ); config_gpio_port(PORT_1, 0x0001 << EXAD_DREADY, GPIO_INPUT_PP ); write_gpio_pin( PORT_1, EXAD_SCLK, FALSE); write_gpio_pin( PORT_1, EXAD_DIN, FALSE); config_gpio_port(PORT_1, 0x0001 << EXAD_SCLK, GPIO_OUTPUT_PP); config_gpio_port(PORT_1, 0x0001 << EXAD_DIN, GPIO_OUTPUT_PP); /* disable external interrupt, active on falling edge of IN_ADC_BUSY */ config_interrupts(DISABLE); config_irq_channel(IRQ_CHANNEL_XTI, DISABLE); XTI->PRH = 0x00; XTI->PRL = 0x00; XTI->MRH = 0x00; XTI->MRL = 0x40; XTI->TRH = 0x00; XTI->TRL = 0x00; XTI->CTRL = 0x00; XTI->CTRL = 0x02; config_irq_channel_priority(IRQ_CHANNEL_XTI, IRQ_PRIORITY_XTI); config_interrupts(ENABLE); } /******************************************** ** ADC ISR ********************************************/ void external_adc_interrupt(void) __arm { unsigned int adc_value; line_value = XTI_InterruptLineValue(); XTI_PendingBitClear(line_value); value = read_external_adc_value(); } /****************************************** ** Peripherals IRQ Handlers Address Table ******************************************/ PUBLIC IRQ_Vectors IRQ_Vectors: T0TIMI_Addr: DD timer_interrupt?A FLASH_Addr: DD FLASHIRQHandler RCCU_Addr: DD RCCUIRQHandler RTC_Addr: DD RTCIRQHandler WDG_Addr: DD WDGIRQHandler XTI_Addr: DD external_adc_interrupt?A USBHP_Addr: DD USBHPIRQHandler I2C0ITERR_Addr: DD I2C0ITERRIRQHandler I2C1ITERR_Addr: DD I2C1ITERRIRQHandler UART0_Addr: DD uart_isr?A UART1_Addr: DD uart_isr?A UART2_Addr: DD uart_isr?A UART3_Addr: DD uart_isr?A BSPI0_Addr: DD BSPI0IRQHandler BSPI1_Addr: DD BSPI1IRQHandler I2C0_Addr: DD I2C0IRQHandler I2C1_Addr: DD I2C1IRQHandler CAN_Addr: DD CANIRQHandler ADC12_Addr: DD adc_isr?A T1TIMI_Addr: DD T1TIMIIRQHandler T2TIMI_Addr: DD T2TIMIIRQHandler T3TIMI_Addr: DD T3TIMIIRQHandler DD 0 ; Reserved DD 0 ; Reserved DD 0 ; Reserved HDLC_Addr: DD HDLCIRQHandler USBLP_Addr: DD USBLPIRQHandler DD 0 ; Reserved DD 0 ; Reserved T0TOI_Addr: DD T0TOIIRQHandler T0OC1_Addr: DD T0OC1IRQHandler T0OC2_Addr: DD T0OC2IRQHandler
Thanks for your reaction but I have read the manual to and for some weird reason it doesn't work in practice.
When I use the debugger all the correct bits are set in the right order. and I can see that the pending bit in the EIC is set, but I don't seem to get into the xti irq_handler.
any suggestions??
kind regards Sander
It's possible that you use another interrupt with higher priority, so the XTI interrupt is not handled.
The easiest way to solve this problem would be, that you sent me the whole project, so that I can debug it.
Thanks, Sasa E-mail: sb@keil.com