.device ATmega328P .def step_mask = r16 .def step_reg = r17 .def loop_count = r18 .def inner_loop_reg_low = r26 .def inner_loop_reg_high = r27 .equ inner_val = 39998 ; Port B Macros .equ DDRB = 0x04 .equ PORTB = 0x05 .equ PINB0 = 0 ; Port B Input Pins bit 0 .equ PINB1 = 1 ; Port B Input Pins bit 1 .equ PINB2 = 2 ; Port B Input Pins bit 2 .equ PINB3 = 3 ; Port B Input Pins bit 3 .equ PINB4 = 4 ; Port B Input Pins bit 4 .equ PINB5 = 5 ; Port B Input Pins bit 5 ; Port D Macros .equ DDRD = 0x0a .equ PORTD = 0x0b .equ PIND2 = 2 ; Port D Input Pins bit 2 .equ PIND3 = 3 ; Port D Input Pins bit 3 .equ PIND7 = 7 ; Port D Input Pins bit 7 .org 0x00 jmp setup setup: ; enable data direction registers; iref, diag1, diag0 are disabled sbi DDRB,PINB0 sbi DDRB,PINB1 sbi DDRB,PINB2 sbi DDRB,PINB3 sbi DDRB,PINB4 sbi DDRB,PINB5 sbi DDRD,PIND2 sbi DDRD,PIND3 sbi DDRD,PIND7 ; configure tmc2100 cfg pins cbi PORTD,PIND7 ; chopper time off (140t_clk), cfg0 sbi PORTD,PINB2 ; current setting (internal sense resistors), cfg3 cbi PORTD,PINB3 ; chopper histeresis (5), cfg4 sbi PORTD,PINB4 ; chopper blank time (24), cfg5 cbi PORTD,PINB5 ; tmc2100 enable pin, cfg6 ; set direction sbi PORTD,(1<