NXC: WriteI2CRegister compile error
Posted: 05 Dec 2010, 09:03
(because it's more a compiler or syntax problem, I moved this post from the Tetrix hardware thread to the software forum...)
I just tried my first Tetrix Motor Control program, but it doesn't compile!
(Bricxcc 3.3.8.9. built 3.11.2010)
I just tried my first Tetrix Motor Control program, but it doesn't compile!
(Bricxcc 3.3.8.9. built 3.11.2010)
Code: Select all
// #include "nxcio.h"
void TXMotorOn(byte NXTport, byte TXmotor, char percentage)
{
byte devAddr, modeReg, powerReg;
char result;
devAddr = (TXmotor+2)&14;
modeReg = 0x44 + (TXmotor % 2)*3;
powerReg= 0x45 + (TXmotor % 2);
// NXTsensorPort, I2Caddress, 44H byte Motor_mode: 0=power control
result=WriteI2CRegister(NXTport, devAddr, modeReg, 0);
// NXTsensorPort, I2Caddress, 45H s/byte Motor_power: e.g. 50 =50%
result=WriteI2CRegister(NXTport, devAddr, powerReg, percentage);
}
task main(){
TXMotorOn(0, 1, 50);
Wait(2000);
TXMotorOn(0, 1,-50);
Wait(2000);
TXMotorOn(0, 1, 0);
Wait(2000);
while (true);
}
what's wrong???# Error: Invalid constant expression: __TXMotorOn_7qG2_modeReg_7qG2_000
File "c:\Temp\temp.nxc" ; line 15
# set __WDSC_SensorRegister, __TXMotorOn_7qG2_modeReg_7qG2_000
#----------------------------------------------------------
# Error: Invalid constant expression: __TXMotorOn_7qG2_powerReg_7qG2_000
File "c:\Temp\temp.nxc" ; line 17
# set __WDSC_SensorRegister, __TXMotorOn_7qG2_powerReg_7qG2_000
#----------------------------------------------------------
2 errors during compilation