I wrote the below simple test program for an Atmega128 MCU running at 14.xx mhz and set the fuse as a 128 not a 103.
When you run the program on a real Mega128 it works just fine.
But I noticed that PortG pins 0,1,2,3 toggle in sequence with portB too.
I don't understand why PortG is doing that. I thought it was still defaulted to inputs as well.
Does someone know?
;mega128 LED test program
; By Earl Bollinger
.include "m128def.inc" ;Includes the m128 definitions file
;define the variables being used
.def Temp = R16
.def delay1 = R17
.def delay2 = R18
.def delay3 = R19
.org 0x0000 ;Start the program code at address 0x0000
rjmp RESET ;Take a Relative Jump to the RESET Label
; initialize the stack pointer
ldi Temp, 0xFF ;Store 255 in Temp
out DDRB, Temp ;Save in The PORTB DDR (make PORTB all outputs)
out PORTB, Temp ;Write Temp to PORTB
dec Temp ;Decrement Temp
rcall Timedelay ; slow it down
rjmp Loop ; Loop Endlessly
; Time Delay SubRoutine
; The three registers or variables are nested
; to perform 255 loops within 255 loops within 16 loops