1541-Steppermotor-Stecker Leitung Userport (Beispiel) rot -- 12V+ rot -- 12V+ gelb -- Q0 PB0 orange -- Q1 PB1 schwarz -- Q2 PB2 braun -- Q3 PB3 Die 12V+ (500mA reichen aus) werden aus einem externen Netzteil gespeist. Stepper-Sequenzen 1,4,2,8 und 9,5,6,10 für Vollschritt in beide Richtungen. Halbschritt: _1_,5,_4_,6,_2_,10,_8_,9 Die im Halbschritt mit _ _ markierte Sequenz ist bei umgekehrter Richtung auszutauschen. |
!to"step.prg",cbm
;---------------------------------------------
; a short example for driving a stepper-motor
; with the C64-Userport ; 09.Mai.2010
; http://www.cbmhardware.de
; X-ASM: ACME
;---------------------------------------------
*=$1000
lda #15
sta 56579 ; DDR PB0-3 out
ldy #00
j1: ldx #00
j0: lda steps,x ; get step-sequence
sta 56577
jsr delay ; waste time
inx
cpx #4
bne j0
iny
cpy #50 ; 200 steps * 1.8 = 360 degrees
bne j1
lda #00
sta 56577 ; power off
rts
steps:
!byte $01,$04,$02,$08 ;full step mode
delay: txa ; waste a lot of CPU-time
pha ; count to 768
tya
pha
ldy #00
j3: ldx #00 ; here maybe some speed-optimization possible
j2: inx ; but be warned: the step-motor will stuck
bne j2 ; if the signal is switched to fast
iny
cpy #3
bne j3
pla
tay
pla
tax
rts
|
Letzte Änderung: 2019-01-03 11:49:07