#14 interrupt


I'm beginner in programming ATMEL. GCBasic is realy great tool for programming. My first project is counter with LED display and I use ATmega8. It was easy to make program. But I experienced error when I wanted to use external interrupt INT0. Finaly I found error in setting GICR register. If you use Intln0 interrupt, compiler automaticaly enables interrupt by setting bit INT0 in this register:

;Start of the main program
lds SysValueCopy,GICR
sbr SysValueCopy,1<<INT0
sts GICR,SysValueCopy

Unfortunalely it doesn't work but I added this lines manualy to my gcb file and it works:

asm LDI R22,64
asm OUT GICR,R22

The only difference is in using OUT instead of STS. Similar situation is when I tried to use other interrupts.
Here is one note from Atmel8 datasheet: When using the I/O specific commands IN and OUT, the I/O addresses 0x00 - 0x3F must be used. When addressing I/O Registers as data space using LD and ST instructions, 0x20 must be added to these addresses.

best regards
Jan Kroulik


  • Hugh Considine
    Hugh Considine

    Should be fixed in the latest update, which can be downloaded from http://gcbasic.sourceforge.net/update.html

    Thanks for reporting the bug!

  • Hugh Considine
    Hugh Considine

    • status: open --> closed-fixed