Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Data colection -AX-11 microcontroller -Interactive C

Status
Not open for further replies.

HelloWorld*ImLost

Newbie level 1
Joined
Nov 25, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,294
[HELP ] Data colection -AX-11 microcontroller -Interactive C

Hi Guys, I hope some one can help me out because I have reached as far as I could alone…

I have an Inex Interactive C Robot Kit which is composed of a “AX-11 microcontroller board is a modified version of the popular Handy board from MIT”.

My current project is to read and record 2 sensors and export the readings/measurements into excel, while one of the sensor controls the motor speed. [simple right? :)]

My difficulty at the moment is to record and export the data to a PC. I have been reading and due to the lack of memory the only way is to export the data via the data cable. However I have not managed to do this. I have been trying to follow the instructions on LINK + click Data Collection , however it seems that they have forgotten to put the conversion code to convert the data on the PC side, as they wrote “The code to do the conversion can be found here” and the HERE is not a click/link button.
Even though I have included the code on the link above on my program, I’m not getting or I don’t know where I am supposed to see/open the data coming from the board/sensors.

If some one could shine a light I would be deeply grateful.
feel free to say that I doing something wrong, but please tell me how to fix it ;)

My code (or my attempt of writing the program);

Code:
/* GP2D120 test*/
/*
Hardware configuration*/
#define base -19
#define pow 80
float dis_table[118]=
{ /*distance value*//*ADC value*/
    32.0,/*19*/ 30.1,/*20*/ 29.5,/*21*/ 28.6,/*22*/ 27.5,/*23*/
      26.1,/*24*/ 25.3,/*25*/ 24.5,/*26*/ 23.7,/*27*/ 23.2,/*28*/
      22.3,/*29*/ 22.0,/*30*/ 21.1,/*31*/ 20.5,/*32*/ 20.0,/*33*/
      19.3,/*34*/ 19.1,/*35*/ 18.4,/*36*/ 17.9,/*37*/ 17.5,/*38*/
      17.1,/*39*/ 16.5,/*40*/ 16.2,/*41*/ 15.8,/*42*/ 15.6,/*43*/
      15.5,/*44*/ 15.3,/*45*/ 14.8,/*46*/ 14.2,/*47*/ 13.8,/*48*/
      13.6,/*49*/ 13.3,/*50*/ 13.1,/*51*/ 12.8,/*52*/ 12.6,/*53*/
      12.4,/*54*/ 12.2,/*55*/ 12.0,/*56*/ 11.8,/*57*/ 11.7,/*58*/
      11.6,/*59*/ 11.6,/*60*/ 11.5,/*61*/ 11.4,/*62*/ 11.3,/*63*/
      10.85,/*64*/ 10.6,/*65*/ 10.3,/*66*/ 10.2,/*67*/ 10.0,/*68*/
      9.8,/*69*/ 9.7,/*70*/ 9.5,/*71*/ 9.3,/*72*/ 9.2,/*73*/
      9.0,/*74*/ 8.9,/*75*/ 8.8,/*76*/ 8.6,/*77*/ 8.4,/*78*/
      8.3,/*79*/ 8.2,/*80*/ 8.0,/*81*/ 7.85,/*82*/ 7.7,/*83*/
      7.6,/*84*/ 7.5,/*85*/ 7.3,/*86*/ 7.2,/*87*/ 7.15,/*88*/
      7.1,/*89*/ 7.0,/*90*/ 6.9,/*91*/ 6.8,/*92*/ 6.7,/*93*/
      6.6,/*94*/ 6.5,/*95*/ 6.4,/*96*/ 6.35,/*97*/ 6.3,/*98*/
      6.2,/*99*/ 6.15,/*100*/ 6.1,/*101*/ 6.0,/*102*/ 5.9,/*103*/
      5.85,/*104*/ 5.8,/*105*/ 5.7,/*106*/ 5.65,/*107*/ 5.6,/*108*/
      5.55,/*109*/ 5.45,/*110*/ 5.4,/*111*/ 5.4,/*112*/ 5.3,/*113*/
      5.2,/*114*/ 5.1,/*115*/ 5.0,/*116*/ 5.0,/*117*/ 4.9,/*118*/
      4.9,/*119*/ 4.8,/*120*/ 4.8,/*121*/ 4.7,/*122*/ 4.7,/*123*/
      4.6,/*124*/ 4.6,/*125*/ 4.5,/*126*/ 4.5,/*127*/ 4.4,/*128*/
      4.4,/*129*/ 4.3,/*130*/ 4.3,/*131*/ 4.2,/*132*/ 4.2,/*133*/
      4.1,/*134*/ 4.1,/*135*/ 4.0/*136*/
  };


void serial_putchar(int c)
{
    while (!(peek(0x102e) & 0x80)); /* wait until serial transmit empty */
    poke(0x102f, c); /* send character */
}

/* necessary to receive characters using serial_getchar */
void disable_pcode_serial()
{
    poke(0x3c, 1);
}

/* necessary for IC to interact with board again */
void reenable_pcode_serial()
{
    poke(0x3c, 0);
}

/* wait for received character */
int serial_getchar(int c)
{
    while (!(peek(0x102e) & 0x20));
    return peek(0x102f);
}
//----------------------------------------------------------------------
//
// sendIntAsAscii
//
// Convert integers to ascii and then prints them out on LCD
//
//----------------------------------------------------------------------
void main()
{
    int an; // Keep analog value from sensor
    int value; // Declare keep input from touch sensor
  
    {
        ao();  // All Motors off 
        while(!stop_button()) // wait STOP button pressed in process
          {
            printf("Press start!\n"); // Show begining message
            while(!start_button()); // Wait START button pressed to run
            while(!stop_button()) // Wait STOP button pressed in process
              {    
                
                an = analog(6); // Read analog value from sensor
                value = analog(4); // Keep value from AI-4 channel
                
                
                if (an>=19 && an<=50)  // distance far away 
                  {
                    motor(0,pow); // Motor0 forward at Pow of maximum power
                    motor(1,pow); // Motor1 forward at Pow value
                    printf("Range cm =%f    Light= %d\n",dis_table[an+base],value);  // Show distance value & light value
                    serial_putchar(value);    // trying to send the data value to the pc
                    serial_putchar(an);        // trying to send the data value to the pc
                }
                
                else if (an>=51 && an<=136)   //distance far away close
                  {
                    motor(0,pow/2); // Motor0 forward at 40% of maximum power
                    motor(1,pow/2); // Motor1 forward at 40% of maximum power
                    printf("Range cm =%f    Light= %d\n",dis_table[an+base],value);  // Show distance value & light value
                    serial_putchar(value);    // trying to send the data value to the pc 
                    serial_putchar(an);       // trying to send the data value to the pc
                    
                }
                
                
                else
                {
                    motor(0,00); // Motor0 forward at 0% of maximum power
                    motor(1,00); // Motor1 forward at 0% of maximum power 
                    printf("Out of Range!   Light= %d\n",value); // Show message out of Range
                }
                
                sleep(0.4); // Delay before read new cycle
                
            }
            printf("Stop...\n"); // Show finish message
            ao(); // Off all motor for ending program
            beep(); // Sound beep for ending program 
            beep(); // Sound beep for ending program
            beep(); // Sound beep for ending program
            sleep(1.5); // Delay before read new cycle
            
        }
    }
}




Thank you in advance!
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top