2006-11-24 03:13 AM
2006-11-24 12:00 AM
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?2006-11-24 03:13 AM
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.