Hi I've got a main program and from that main program I do a breq to hiccup
As long as I only use timeoutL in the hiccup file everything goes well but if I include timeoutH also I get a 'Error relative branch out of reach'
timeoutL and timeoutH fill a counter in the interuptfile that occurs every 1msec to make a timer.
The mode bit is set if the timer is zero.
I can not figure out what I'm doing wrong or did I something that is not possible?
I include a piece of the code.
Main: ldi temp0,$00 ;tijdelijk voor alleen hiccup!!!! Load $00 into register temp0 mov pwm,temp0 ;tijdelijk voor alleen hiccup!!!! move the content of temp0 into register pwm ;*** selection of the setting *** in temp0,PINA ;read all the pins of port A into temp0 ; ANDI temp0,$88 ;only look at bit #3 and #7 ANDI temp0,$08 ;only look at bit #3 cpi temp0,$08 ;is bit #3 set (and bit #7 not set)? breq hiccup ;yes jump to Hiccup cpi temp0,$00 ;are bit #3 (and #7 not set)? breq latch ;yes jump to Latch
;*** start hiccup mode and max alarm *** Hiccup: mov temp0, ana1 ;Load the content of ana1 into temp0 this is the ADvalue from PA0 cpi temp0, maxI ;Compare temp0 with the constant maxI.C-flag is 1 if MaxI is higher otherwise C-flag is 0 brcs main3 ;Branch if C-flag is set (1) to main3 ldi temp0,$FF ;Load $FF into register temp0 mov pwm,temp0 ;move the content of temp0 into register pwm ldi temp0,250 ;load 250 into register temp0 ldi temp1,0 mov timeoutL,temp0 ;move the content of temp0 into register timeoutL mov timeoutH,temp1 cbi portB,0 ;set bit 0 on port B low (green led) sbi portB,1 ;set bit on output PB1 high (red Led) sbi portA,6 ;set bit 6 on port A high (relay) main1: sbrs mode,7 ;jump over the next instruction if bit 7 in register mode is set (1) rjmp main1 ;Jump to main1 (250 x 1ms wachten) cbr mode,$80 ;Clear bit 7 in register mode (set to 0) ldi temp0,50 ;load 50 into register temp0 mov timeoutL,temp0 ;move the content of temp0 into register timeoutL