**********************************************************************
; *
; Filename: PTPIC.asm *
; Date: 14/09/2019 *
; File Version: 1.61 *
; *
; Author: W.K.Todd *
; Company: Todd Electronics *
; *
; *
;**********************************************************************
; *
; Files Required: P16F1572.INC *
; Pulse Train generator for stepper driving * *
;**********************************************************************
; Serial control commands (@19200 baud) *
; All commands are 10 ascii chars *
; (Axis, Command, and 8 hex) terminated with colon (:) *
;**********************************************************************
;x = axis (X,Y, Z, or E)
; xA0000tttt set Acceleration/deceleration time
; tttt - time in centiSeconds = 0.01S (hex16)
; xB00000000 Brake - decelerate to stop
; xFdc0iffff set frequency
; ffff = frequency in Hz (hex16) (maximum is about 25kHz with 32Mhz PIC)
;
; d = direction (0 or 1)
; c = cycle (0 or 1)
; i = immediate (0 or 1)
; xDxxxxxxxx: set number of steps (Distance) 32bits hex
; xCxxxxxxxx: set cycle steps (reverse direction at cycle)
; xNhhhhhhhh Nudge cycle left or right
; h = 32bit signed hex
; <7fffffff = positive = left = dir 0
; >7fffffff = negative = right =dir 1
; xOelnk0pms Options
; e - 0 or 1 motor enable
; l - 0 or 1 limit enable
; n - continue cycle count and direction
; k - continue steps
; p = polarity 0 falling edge or 1 rising edge
; m - Motor enable active 1= high 0=low
; s - limit Sensor active 1=high 0=low
; xP00000000: Position - set ABS position
;
; xSel000000: axis stop
; e - 0 or 1 motor Enable
; l - 0 or 1 check if at limit (returns xL: if at limit)
; xGel000000: axis start (go)
; e - 0 or 1 motor Enable off when stopped
; l - 0 or 1 Limit enable
; xV00000000: version string
;************************************************************************
; AS00000000: All stop (no options are set)
; AG00000000: All go (no options are set)
;************************************************************************
;Responces:
; PTPIC vx.xx: (xV00000000:)
; xShhhhhhhh: - axis has stopped
; hhhhhhhh= ABS position (32bit hex)
; xNhhhhhhhh: - Cycle Position
; hhhhhhhh= position (32bit hex)
; xG: - axis is running
; xC: - Cycle has reversed
; xL: - Limit hit (when enabled or checked)
;
;**********************************************************************
;e.g. quick setup acctm 2.5s cycle 0.5Hz Frq 1kHz
;X go @ 1000hz 10s acceleration >XA00000100:XC000003ff:XD0fffffff:XF000003e8:XG00000000:
;X decelerate to stop >XB00000000:
;Y go and oscillate > YA00000100:YC000003ff:YD0fffffff:YF010003e8:YG00000000:
;Y nudge left or right > YN000000ff: YNffffff00: