go_away

Author Topic: read and save data from sharp ir  (Read 836 times)

0 Members and 1 Guest are viewing this topic.

Offline piravlosTopic starter

  • Beginner
  • *
  • Posts: 4
  • Helpful? 0
read and save data from sharp ir
« on: November 01, 2010, 09:01:51 PM »
hello

i want to read and save the data from a sharp ir which is connected to the microcontroller. how can i do that?

thanks

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,943
  • Helpful? 98
Re: read and save data from sharp ir
« Reply #1 on: November 02, 2010, 07:20:35 AM »
Connect the Sharp to an analog input pin. Write code to set-up the ADC for that pin, do an ADC conversion, read the ADC data and save it.

This is all we can tell you with out knowing more.
Which microcontroller?
Where do you want the data saved?

There are also many threads here that discuss using the Sharp sensors. A search will bring up lots of info and even code examples.

Offline piravlosTopic starter

  • Beginner
  • *
  • Posts: 4
  • Helpful? 0
Re: read and save data from sharp ir
« Reply #2 on: November 02, 2010, 08:59:25 AM »
hello thanks for the reply.

i want to save the data in an array.

my problem is that i do not know how to start. how do i set up the ADC and do the conversion?

thanks

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,943
  • Helpful? 98
Re: read and save data from sharp ir
« Reply #3 on: November 02, 2010, 09:30:56 AM »
Learn the C programming language, putting data into arrays is common.

Offline piravlosTopic starter

  • Beginner
  • *
  • Posts: 4
  • Helpful? 0
Re: read and save data from sharp ir
« Reply #4 on: November 03, 2010, 08:35:04 AM »
void SetChanADC(){ OpenADC(ADC_FOSC_RC & ADC_RIGHT_JUST & ADC_0_TAD,
      ADC_CH7&  ADC_INT_OFF & ADC_VREFPLUS_VDD & ADC_VREFMINUS_VSS, 15 );
}

void configure_ADC() {
      OpenADC(ADC_FOSC_RC & ADC_RIGHT_JUST & ADC_0_TAD,
      ADC_CH7&  ADC_INT_OFF & ADC_VREFPLUS_VDD & ADC_VREFMINUS_VSS, 15);
}
 is something wrong here?

thanks

 


Get Your Ad Here

data_list