driving two motors (x,y) with 16 steps can be realized by one byte orders (16 stepmodes in upper 4 bit, 16 in lower 4 bit)
as never two same states follow each other, two same bytes in follow can be recognized as exit of one byte mode.
16 steps means, a stepper with 50 stages has 800 steps for one turnaround - the 16 steps realize 4 pole modes ( ++ +- -- -+ ) within 4 power modes for xAB and yAB windings between steps - for smooth running and high resolution. For instance for use of SMC1500:
https://www.conrad.de/de/steuerkarte-emis-smc-1500-24-vdc-15-a-967785.html
in case of interest, I can post the motor steering sequence too...
as never two same states follow each other, two same bytes in follow can be recognized as exit of one byte mode.
16 steps means, a stepper with 50 stages has 800 steps for one turnaround - the 16 steps realize 4 pole modes ( ++ +- -- -+ ) within 4 power modes for xAB and yAB windings between steps - for smooth running and high resolution. For instance for use of SMC1500:
https://www.conrad.de/de/steuerkarte-emis-smc-1500-24-vdc-15-a-967785.html
B4X:
'(thanks, Erel...)
process globals
Dim singleByteMode As Boolean
Dim singleByteFirst As Boolean = True
Dim singleByteIn As Int
Dim singleByteLastIn As Int
end sub
private Sub Astream_NewData(Buffer() As Byte)
If singleByteMode = True Then
singleByteIn = bc.StringFromBytes(Buffer)
If singleByteIn= singleByteLastIn And singleByteFirst = False Then ' exit single byte mode
singleByteMode = False ' exit at same byte
log("singleByteMode false")
singleByteFirst = True
return
End If
singleByteFirst = False ' ignore first
singleByteLastIn = singleByteIn
Return
End If
If bc.StartsWith(Buffer,"<s:".GetBytes) Then ' start single byte mode - "<s:" as order
singleByteMode = True
log("singleByteMode true")
Return
End If
end sub
in case of interest, I can post the motor steering sequence too...
Last edited: