go_away

Author Topic: read and save data from sharp ir  (Read 721 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,661
  • Helpful? 84
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,661
  • Helpful? 84
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

 

Related Topics

  Subject / Started by Replies Last post
5 Replies
2774 Views
Last post July 05, 2008, 01:59:17 PM
by Admin
9 Replies
3003 Views
Last post December 02, 2008, 10:43:07 PM
by Admin
4 Replies
873 Views
Last post March 18, 2009, 12:57:23 PM
by paulstreats
2 Replies
596 Views
Last post July 30, 2010, 01:48:13 PM
by Warhawk87


Get Your Ad Here