programming atmega48

Oct 02, 2008 0 Replies

sci.electronics.design programming atmega48



The code below is intended to detect a rising transition on the external interput pin by sampling the flag register but it doesn't work on an atmega48. With the ei-mask bit set (no sei), the code didn't detect a transition either. On an atmega162 this does work, however, and the documentation describes the functioning of the flags in the same manner. Perhaps the 48 requires setting something I missed. Any suggestions?



Hul



; areg is defined as r16 ldi areg, 0xc ; set external irpt 1 for rising edge sts EICRA, areg sbi EIFR, 1 ; clear flag in ext irpt 1 - number 1 bit



; stalling untill meas device is connected & running exirst1: in areg, EIFR andi areg, 2 ; check flags existence brz exirst1 ; & wait if not there



Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required