Introduction: How Turn Nema Stepper Motor With Cnc Shield V4.0 in Avr Assembly Atmega328

About: I like electronics and informatics!

This tutorial explain how turn a unipolar stepper motor with cnc shield v4.0 directly from avr assembly and compile ,upload directly from web (with webusb)

Supplies

stepper nema17

cnc shield v4.0

online compiler uploader

https://costycnc.github.io/avr-compiler-js#shieldv40

Step 1: The Code

.org 0x60

;arduino nano cnc shield v4.0

sbi 4,0 ;pin DIR as output D8 PORTB,PB0

sbi 0xa,5 ;pin STEP as output D5 PORTD,PD5

cbi 5,0 ;enable DIR pin D8 -put high

init:

sbi 0xb,5 ;put pin STEP high

rcall pause ;pause

cbi 0xb,5 ;put pin STEP low

rcall pause ;pause

rjmp init ;repeat


pause:

dec R16

brne pause

ret