ROBOTC.net forums
http://robotc.net/forums/

Sensor Multiplexer
http://robotc.net/forums/viewtopic.php?f=52&t=7870
Page 1 of 1

Author:  TheTerrorBelow [ Tue Feb 04, 2014 7:22 pm ]
Post subject:  Sensor Multiplexer

I was trying to create a testbed for the Sensor Multiplexer so that I could test how it would work for our robot. I chose 4 different sensors and tried to configure them. My program does not read any errors, however the errors the debugger window comes up with are all in the included drivers from Xander's suite. I have the newest update of the Suite, and have not had these errors before. I have included my code and here are the errors it is registering:


Quote:
**Error**:'*' Indirection levels mismatch. Call to 'sendI2CMsg'. Parameter: 'char * pSendMsg' is 'error_array[0]' of type 'ubyte'.
**Error**:'*' Indirection levels mismatch. Call to 'sendI2CMsg'. Parameter: 'char * pSendMsg' is 'data[0]' of type 'ubyte'.
**Error**:'*' Indirection levels mismatch. Call to 'sendI2CMsg'. Parameter: 'char * pSendMsg' is 'data[0]' of type 'ubyte'.
**Error**:'*' Indirection levels mismatch. Call to 'readI2CReply'. Parameter: 'char * pReplyBytes' is 'data[0]' of type 'ubyte'.
**Error**:Array size mismatch. Call to 'writeI2C'. Parameter: 'short replylen' is 'LEGOUS_I2CReply' of type 'tByteArray'.
**Error**:Array size mismatch. Call to 'writeI2C'. Parameter: 'short replylen' is 'LEGOUS_I2CReply' of type 'tByteArray'.
**Error**:Not enough parameters specified. Call to 'writeI2C'. Parameter: 'short replylen' is 'None specified'.
**Error**:Array size mismatch. Call to 'writeI2C'. Parameter: 'short replylen' is 'HTCS2_I2CReply' of type 'tByteArray'.
**Error**:Array size mismatch. Call to 'writeI2C'. Parameter: 'short replylen' is 'HTCS2_I2CReply' of type 'tByteArray'.
**Error**:Array size mismatch. Call to 'writeI2C'. Parameter: 'short replylen' is 'HTCS2_I2CReply' of type 'tByteArray'.
**Error**:Array size mismatch. Call to 'writeI2C'. Parameter: 'short replylen' is 'HTCS2_I2CReply' of type 'tByteArray'.
**Error**:Array size mismatch. Call to 'writeI2C'. Parameter: 'short replylen' is 'HTCS2_I2CReply' of type 'tByteArray'.
**Error**:Array size mismatch. Call to 'writeI2C'. Parameter: 'short replylen' is 'HTCS2_I2CReply' of type 'tByteArray'.
**Error**:Array size mismatch. Call to 'writeI2C'. Parameter: 'short replylen' is 'HTCS2_I2CReply' of type 'tByteArray'.
**Error**:Not enough parameters specified. Call to 'writeI2C'. Parameter: 'short replylen' is 'None specified'.
**Error**:Array size mismatch. Call to 'writeI2C'. Parameter: 'short replylen' is 'HTSMUX_I2CReply' of type 'tByteArray'.
**Error**:Not enough parameters specified. Call to 'writeI2C'. Parameter: 'short replylen' is 'None specified'.
**Error**:Not enough parameters specified. Call to 'writeI2C'. Parameter: 'short replylen' is 'None specified'.
**Error**:Array size mismatch. Call to 'writeI2C'. Parameter: 'short replylen' is 'HTSMUX_I2CReply' of type 'tByteArray'.
**Error**:Array size mismatch. Call to 'writeI2C'. Parameter: 'short replylen' is 'HTSMUX_I2CReply' of type 'tByteArray'.
**Error**:Not enough parameters specified. Call to 'writeI2C'. Parameter: 'short replylen' is 'None specified'.


Attachments:
SMUX_TEST.c [895 Bytes]
Downloaded 546 times

Author:  BurningLights [ Tue Feb 04, 2014 10:40 pm ]
Post subject:  Re: Sensor Multiplexer

What version of ROBOTC are you using? It could be that the latest drivers are not compatible with older ROBOTC versions.

Author:  mightor [ Wed Feb 05, 2014 1:59 am ]
Post subject:  Re: Sensor Multiplexer

That looks like an error you'd get if you use the drivers with an old version of ROBOTC.

= Xander

Author:  TheTerrorBelow [ Thu Feb 06, 2014 1:16 pm ]
Post subject:  Re: Sensor Multiplexer

I reloaded Xander's driver suite, and I am running ROBOTC 3.62. That fixed the errors, but now I am having trouble getting the sensors to read any values. Sensors 1 and 3 read values of 0, and 2 and 4 read values of 1023

Author:  mightor [ Thu Feb 06, 2014 3:14 pm ]
Post subject:  Re: Sensor Multiplexer

Without seeing your code, it's completely impossible to see what could be the cause.

= Xander

Author:  TheTerrorBelow [ Thu Feb 06, 2014 5:11 pm ]
Post subject:  Re: Sensor Multiplexer

The current code has not changed much since the original post, but here is the current file.

Attachments:
SMUX_TEST.c [850 Bytes]
Downloaded 889 times

Author:  MHTS [ Thu Feb 06, 2014 8:35 pm ]
Post subject:  Re: Sensor Multiplexer

There are multiple problems in your code. First, you need to read Xander's example code on how to read each sensor. Since you are using his driver suite, you can't just read SensorValue for sensors behind the Sensor MUX, you need to call the functions in Xander's drivers. Secondly, you have improper use of the nxtDisplayTextLine function. The corrected code looks something like below:
Code:
#pragma config(Sensor, S1,     HTSMUX,         sensorI2CCustom)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "drivers\hitechnic-sensormux.h"
#include "drivers\lego-ultrasound.h"
#include "drivers\lego-sound.h"
#include "drivers\lego-touch.h"
#include "drivers\hitechnic-colour-v2.h"

#define LGSONAR msensor_S1_1
#define LGSOUND msensor_S1_2
#define HTCOLOR msensor_S1_3
#define LGTOUCH msensor_S1_4

task main()
{
    while (true)
    {
        nxtDisplayTextLine(1, "Sonar=%d", USreadDist(LGSONAR));
        nxtDisplayTextLine(2, "Sound=%d", SNDreadNorm(LGSOUND));
        nxtDisplayTextLine(3, "Color=%d", HTCS2readColor(HTCOLOR));
        nxtDisplayTextLine(4, "Touch=%d", TSreadState(LGTOUCH));
        wait1Msec(100);
    }
}

Author:  mightor [ Fri Feb 07, 2014 6:37 am ]
Post subject:  Re: Sensor Multiplexer

Thanks MHTS :)

= Xander

Author:  raima55 [ Tue Oct 21, 2014 1:24 am ]
Post subject:  Re: Sensor Multiplexer

Thank you for your contributions! Very interesting!

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/