Rev 1211 | Rev 1378 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1211 | Rev 1322 | ||
---|---|---|---|
Line 7... | Line 7... | ||
7 | unsigned char motor = 0; |
7 | unsigned char motor = 0; |
8 | unsigned char motorread = 0,MissingMotor = 0; |
8 | unsigned char motorread = 0,MissingMotor = 0; |
9 | unsigned char motor_rx[16],motor_rx2[16]; |
9 | unsigned char motor_rx[16],motor_rx2[16]; |
10 | unsigned char MotorPresent[MAX_MOTORS]; |
10 | unsigned char MotorPresent[MAX_MOTORS]; |
11 | unsigned char MotorError[MAX_MOTORS]; |
11 | unsigned char MotorError[MAX_MOTORS]; |
- | 12 | unsigned int I2CError = 0; |
|
Line 12... | Line 13... | ||
12 | 13 | ||
13 | //############################################################################ |
14 | //############################################################################ |
14 | //Initzialisieren der I2C (TWI) Schnittstelle |
15 | //Initzialisieren der I2C (TWI) Schnittstelle |
15 | void i2c_init(void) |
16 | void i2c_init(void) |
Line 114... | Line 115... | ||
114 | break; |
115 | break; |
115 | case 1: |
116 | case 1: |
116 | i2c_write_byte(Motor[motor++]); |
117 | i2c_write_byte(Motor[motor++]); |
117 | break; |
118 | break; |
118 | case 2: |
119 | case 2: |
- | 120 | if(TWSR == 0x30) |
|
- | 121 | { |
|
- | 122 | if(!missing_motor) missing_motor = motor; |
|
119 | if(TWSR == 0x30) { if(!missing_motor) missing_motor = motor; if(++MotorError[motor-1] == 0) MotorError[motor-1] = 255;} |
123 | if(++MotorError[motor-1] == 0) MotorError[motor-1] = 255; |
- | 124 | } |
|
120 | i2c_stop(); |
125 | i2c_stop(); |
121 | I2CTimeout = 10; |
126 | I2CTimeout = 10; |
122 | twi_state = 0; |
127 | twi_state = 0; |
123 | i2c_start(); |
128 | i2c_start(); |
124 | break; |
129 | break; |