Toggle EICRA.ISC21
datasheet :
ISCn1 ISCn0 Description
0 0 The low level of INTn generates an interrupt request.
0 1 Reserved
1 0 The falling edge of INTn generates asynchronously an interrupt request.
1 1 The rising edge of INTn generates asynchronously an interrupt request
so you must toggle ISC20 !
And the interrupt must have been set up for falling edge
also note this from the pdf :
When changing the ISCn1/ISCn0 bits, the interrupt must be disabled by clearing its Interrupt
Enable bit in the EIMSK Register. Otherwise an interrupt can occur when the bits are changed.
but indeed you can best use a pin that supports the change int.
So the first sample should work IMO.
Is the chip in m103 mode or m128 mode?
Do other programs work?
And it the speed right? when you specify $crystal = 16000000 , does it really run at that speed?
do a loop where you toggle a pin with waitms 1000 , so you can measure the frequency.
↧