Тёмный

Scara robot with cnc shield v3 0 and avr assembly code explain costycnc 

Boboaca Costel
Подписаться 4,6 тыс.
Просмотров 47
50% 1

Put this code in web page www.costycnc.it/avr1 and compile and upload to arduino uno cnc shield v3.0(you can modify code or create one new directly from web browser!!!)
;for scala robot, draw a rhombus continuous
.equ DDRB=4
.equ PORTB=5
.equ DDRD=10
.equ PORTD=11
.equ PB0=0 ;ENABLE
.equ PD5=5 ;STEP
.equ PD2=2 ;DIRECTION
.equ PD6=6 ;STEP
.equ PD3=3 ;DIRECTION
.org 0x60
init:
; arduino nano cnc shield v3.0
sbi DDRB,PB0 ;enable motors
sbi DDRD,PD2 ;step motor x
sbi DDRD,PD5 ;dir motor x
sbi DDRD,PD3 ;step motor y
sbi DDRD,PD6 ;dir motor y
cbi PORTB,PB0 ; enable motors
loop:
cbi PORTD,PD5 ;set DIR pin low
call turnx ;turn motor x
sbi PORTD,PD6 ;set DIR pin high
call turny ;turn motor y
sbi PORTD,PD5 ;set DIR pin low
call turnx ;turn motor x
cbi PORTD,PD6 ;set DIR pin high
call turny ;turn motor y
rjmp loop ;loop
turnx:
ldi r21,3
turn1:
call stepx
dec R20
brne turn1
dec R21
brne turn1
ret
turny:
ldi r21,3
turn2:
call stepy
dec R20
brne turn2
dec R21
brne turn2
ret
stepx:
sbi PORTD,PD2 ; put high pin STEP motor x
rcall pulse ;pulse
cbi PORTD,PD2 ;put low pin Step motor x
rcall pulse ;pulse
ret
stepy:
sbi PORTD,PD3 ; put high pin STEP motor y
rcall pulse ;pulse
cbi PORTD,PD3 ; put high pin STEP motor y
rcall pulse ;pulse
ret
pulse:
ldi r17,3
pls:
dec R16
brne pls
dec R17
brne pls
ret

Наука

Опубликовано:

 

10 май 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии    
Далее
Elden Ring DLC - ПОДОЖГЛО ПОПУ!
07:26
Просмотров 517 тыс.
skibidi toilet multiverse 039 (part 4)
06:06
Просмотров 2,9 млн
Espduino + TMC2209 + CNC shield
9:02
Просмотров 4,2 тыс.
I found PERFECT display
51:32
Просмотров 553 тыс.
India's Raspberry Pi Rival ( Thats Better )
12:31
Просмотров 148 тыс.
Massimo Banzi 🤖 Founder of ARDUINO
29:31
Просмотров 138 тыс.
АЙФОН Г0ВН0
0:54
Просмотров 1,2 млн
Здесь упор в процессор
18:02
Просмотров 393 тыс.