@@ -19,16 +19,16 @@ The following paragraphs provide some insights into the software structure:
1919 - Check RX buffer, run cmd_interpreter if flag is set
2020 - process state machine:
2121 - move (pending MOVE command), finish at target position, abort on over_current
22- - home (pending HOME command), finish on over_current, abort on timeout (2 minutes)
23- - default (idle: check STATUSflags and switch state to move, home or bootload)
24- - .move? set state to move
25- - .home? set state to home
26- - .bootload? generate RESET
22+ - home (pending HOME command), finish on over_current, abort on timeout (2 minutes)
23+ - default (idle: check STATUSflags and switch state to move, home or bootload)
24+ - STATUSflags .move? set main_state to state_move
25+ - STATUSflags .home? set main_state to state_home
26+ - STATUSflags .bootload? generate RESET
2727
2828** cmd interpreter**
2929Process commands and queries (?) from ESP:
30- - Move: state = move
31- - Home: state = home
30+ - Move: save active drive and current limit, set g_STATUSflags. move
31+ - Home: save active drive and current limit, set g_STATUSflags. home
3232 - Status? send status data (position[ 1..4] , motor current, STATUSflags
3333 - Version? send PIC version
3434 - SetPos? send positions[ 1..4]
@@ -40,15 +40,16 @@ Process commands and queries (?) from ESP:
4040 - HFINTOSC (16 MHz),
4141 - I²C (master, 400 kHz)
4242 - UART (38400 Bd, 8 data bit, 1 stop bit)
43- - PWM (125 Hz: 7.2 ms High + 0.8 ms Low = 8 ms)
43+ - PWM1_SaP1_out: (125 Hz: 7.2 ms High + 0.8 ms Low = 8 ms) <br >
44+ PWM1_SaP2_out: (125 Hz: 2.0 ms High + 6.0 ms Low = 8 ms)
4445 - Interrupts (see #interrupt)
4546
4647### interrupt.c
4748Configures the Vectored Interrupt Manager and contains the corresponding
4849interrupt service routines (ISR).
49- - IOC Interrupt On Change, high priority (see user manual)
50- - on any rising edge on port RA5/4, RC5/4, RC3/6, RC7/RB7 : read motor current
51- - on any falling edge on port RA5/4, RC5/4, RC3/6, RC7/RB7 : read Back EMF
50+ - PWM1 Parameter Interrupt
51+ - on falling edge of PWM1_SaP2_out (2 ms after H-bridge ON) : read motor current
52+ - on falling edge of PWM1_SaP1_out (0 ms when H-bridge OFF) : read Back EMF
5253 - TMR0 (1 ms system clock)
5354 - U1RX (UART1 RX data from ESP)
5455
0 commit comments