View unanswered posts | View active topics It is currently Wed Nov 22, 2017 8:07 pm






Reply to topic  [ 4 posts ] 
EV3 with HiTechnic SuperPro using RC4.28B w driversuite 3.3 
Author Message
Rookie

Joined: Thu Nov 06, 2014 2:23 am
Posts: 9
Post EV3 with HiTechnic SuperPro using RC4.28B w driversuite 3.3
I am new FTC coach and new user of RobotC, but quite experienced in MCU control in general. I had difficulties to get the HTSPB examples in the driversuite to work. After some trials and errors, everything is working OK.

The solution was to
  • View-> Preferences > Detailed Preferences ..., Compiler Tab, Include Directories Tab
    Set include directory path to
    E:\My Projects\Robotics\RobotC\robotcdriversuite-master\include\
    Note: The "drivers" is not part of the path name in the downloaded driversuite
  • Change the #include "drivers/HTSPB-driver.h" into #include "hitechnic-superpro.h"
  • Change the configuration pragma
    from #pragma config(Sensor, S1, HTSPB, sensorI2CCustom9V)
    to #pragma config(Sensor, S1, HTSPB, sensorEV3_GenericI2C)
  • Change the display commands
    from nxtDisplayTextLine
    to displayString

For example the HTSPB-exp2.c in the driversuite is (and as such not working with EV3)
Code:
#pragma config(Sensor, S1,     HTSPB,                sensorI2CCustom9V)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

/*   HiTechnic Experimenter's Kit for the SuperPro

Experiment - 2 Six LEDs and a Potentiometer

This program reads the analog value of a potentiometer and outputs a
digital value to one of six LEDs.

*/

#include "drivers/HTSPB-driver.h"

task main() {
  int inputdata;
  ubyte outputdata;
  int bit;

  // Set B0 as output
  HTSPBsetupIO(HTSPB, 0x1);

  while(true) {
    // Read a 10bit wide analogue value from A0
    inputdata = HTSPBreadADC(HTSPB, 0, 10);

    nxtDisplayTextLine(1, "A0: %d", inputdata);

    // Set the output bit based on the analogue input value
    bit = (inputdata/128);
    if (bit > 5) bit = 5;
    outputdata = 1 << bit;

    HTSPBwriteIO(HTSPB, outputdata);
    wait1Msec(50);
  }
}


After the modifications, the following code works with EV3.
Code:
#pragma config(Sensor, S1,     HTSPB,          sensorEV3_GenericI2C)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

/*   HiTechnic Experimenter's Kit for the SuperPro

Experiment - 2 Six LEDs and a Potentiometer

This program reads the analog value of a potentiometer and outputs a
digital value to one of six LEDs.

*/

#include "hitechnic-superpro.h"

task main() {
  int inputdata;
  ubyte outputdata;
  int bit;

  // Set B0 as output
  HTSPBsetupIO(HTSPB, 0x1);

  while(true) {
    // Read a 10bit wide analogue value from A0
    inputdata = HTSPBreadADC(HTSPB, 0, 10);

    displayString(1, "A0: %d", inputdata);

    // Set the output bit based on the analogue input value
    bit = (inputdata/128);
    if (bit > 5) bit = 5;
    outputdata = 1 << bit;

    HTSPBwriteIO(HTSPB, outputdata);
    wait1Msec(50);
  }
}


Cheers, Ollie


Wed Feb 04, 2015 11:45 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: EV3 with HiTechnic SuperPro using RC4.28B w driversuite
The 9V pin on the I2C port is currently not trivial to enable. Setting the sensor port to sensorI2CCustom9V does not work and sensorEV3_GenericI2C does not enable that pin. I'll post a work-around on my blog in the next couple of days.

Also, you should not be using that particular version of the driver suite with ROBOTC 4.x, rather the one in Github, which you can download here: https://github.com/botbench/robotcdriversuite

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Thu Feb 05, 2015 1:50 am
Profile WWW
Rookie

Joined: Thu Nov 06, 2014 2:23 am
Posts: 9
Post Re: EV3 with HiTechnic SuperPro using RC4.28B w driversuite
Mightor,

Thanks for a rapid and relevant response. I did use the driver suite from your Github account. It could be obvious for the seasoned RobotC developers where to get the "3rd party" include files, but the instructions in RobotC web site are not quite clear about that.

I am looking forward for the work-around instructions in your blog. Could the similar ideas be used to get the Tetrix motor/servo controllers to be connected to EV3?

Best Regards, Ollie


Thu Feb 05, 2015 2:45 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: EV3 with HiTechnic SuperPro using RC4.28B w driversuite
The work-around is for sensors that require 9V on pin1, not a motor controller :)

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Thu Feb 05, 2015 2:56 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.