Skip to main content
Visitor II
November 24, 2006
Question

Interrupts and ADC

  • November 24, 2006
  • 2 replies
  • 756 views
Posted on November 24, 2006 at 12:13

Interrupts and ADC

    This topic has been closed for replies.

    2 replies

    gavin1Author
    Visitor II
    November 24, 2006
    Posted on November 24, 2006 at 09:00

    Hello All,

    I'm new to programming the ST7 and I'm trying to work out how to deal with interrupts without the ADC.

    I've inherited some code that uses the ADC on an I/O but I want to turn the ADC off and just use the I/O in question to read binary input.

    When I try and do this however the timer interrupt seems to cease to funtion. How can I seperate the ADC from the timer code and retain only the timer code.

    Currently it seems like my interrupt may be getting called but is not returning...

    Within the Interrupt handler is the line:

    _asm('' LD A,_ATCSR ''); //reset overfl. int flag

    and later

    _asm('' BSET _ATCSR,#0 '');

    but does loading the contents of ATCSR into accumulator reset the overflow flag or does setting the LSB reset the overflow flag?

    Visitor II
    November 24, 2006
    Posted on November 24, 2006 at 12:13

    If you are using a LITE device, reading the ATCSR in any form will reset the interrupt. Putting it into the accumulator has no additional effect on the interrupt status.

    It looks like you are using the COSMIC compiler. If so, you can write < varname >; to generate a dummy read of < varname >. This can be useful when clearing interrupts.

    Setting the LSB (at least on a LITE0, quickest datasheet to hand) just re-enables the interrupt if it was disabled at any other stage.