4.22 limit switch mode constants?

General discussion of using Roboclaw motor controllers
Post Reply
Will Pickering
Posts: 2
Joined: Tue Dec 13, 2016 4:29 pm
4.22 limit switch mode constants?

Post by Will Pickering »

Hi,

Since the manual still seems to be at version 4.20 can you confirm the limit switch constants.

Here is what I have found my changing in the studio and reading back via code:

Estop Latch 129
Estop 1
V Clamp 20
Brake 4
Home Auto 226
Home User 98
Home Auto Lim Forward 194
Home User Lim Forward 66
Limit Forward 18
Limit Reverse 34
Limit Both 2

Is there a current change list for v22? There seems to be other wierdness in our program when we jumped from 4.20? (we are using the 2x7 controller)

For example the motor polarity seemed to swap on both motors. Velocity and Position to get positive encoder counts required swapping motor leads.

Any way to get a copy of 4.20 just in case we can't get everything else working?

Thanks,
Will
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: 4.22 limit switch mode constants?

Post by Basicmicro Support »

Thos sound liek the two changes. The limit switch code was the big change. At the same time some motor directions may have changed because of changes in the interal PWM handler code.

See update list of changes in firmware update sticky post.

The Pin Selections are now bit masks instead of just a numbered list. The bit masks are:

#define SIGTYPE_DISABLED 0x00

#define SIGTYPE_ESTOP 0x01
#define SIGTYPE_LIMIT 0x02
#define SIGTYPE_EX 0x04

#define SIGFLAG_INV 0x08

//ESTOP
#define SIGFLAG_LATCH 0x80

//LIMIT
#define SIGFLAG_FOREWARD 0x10
#define SIGFLAG_BACKWARD 0x20
#define SIGFLAG_HOME 0x40
#define SIGFLAG_AUTO 0x80

//EX Mode
#define SIGFLAG_BRAKE 0x00
#define SIGFLAG_CLAMP 0x10
#define SIGFLAG_RS485 0x20
#define SIGFLAG_RES1 0x30
#define SIGFLAG_RES2 0x40
#define SIGFLAG_RES3 0x50
#define SIGFLAG_RES4 0x60
#define SIGFLAG_USER 0x70
#define SIGFLAG_ENCMODE 0x80

SIGTYPE bits are exclusive currently(eg only one of the SIGTYPEs should be set at any time for an individual pin.

Each SIGTYPE supports different SIGFLAGS. SIGFLAG_INV is supported by all SIGTYPEs.

LIMIT flags Note:
1. When setting the limit flags SIGFLAG_FOREWARD and SIGFLAG_BACKWARD are never used at the same time. To set a pin to support both forward and backward limits at the same time set neither of these flags, otherwise set the direction the LIMIT should activate in(eg SIGTYPE_LIMIT | SIGFLAG_BACKWARD or SIGTYPE_LIMIT | SIGFLAG_FOREWARD).
2. The HOME flag is only active in the reverse/backward direction.

Post Reply