New lower price for Axon II ($78) and Axon Mote ($58).

0 Members and 1 Guest are viewing this topic.

Computer is a Toshiba laptop, running XP-SP3.

the IR Sonar Range Finder

Current readings, pointing at the ceiling, shows a range of 60 - 124.

a2dSetPrescaler(ADC_PRESCALE_DIV128); // configure ADC scalingwhile(1) rprintf("%d\r\n",a2dConvert10bit(value));

I have a sharp GP2D12 that puts out 2.55V period. No ifs and or buts. The sonar is set on my tabletop, pointing straight up.Your code (I added a delay_ms(100) to it) puts out a range of 27-32.

while(1) { int Reading = a2dConvert10bit(value); if (MAX < Reading) MAX = Reading; if (MIN > Reading) MIN = Reading; rprintf("Reading = %d MAX = %d MIN = %d\r\n", Reading, MAX, MIN); rprintf("Measurement = %d cm.\r\n\n", sonar_MaxSonar(Reading)); delay_ms(500); }

Reading = 37 MAX = 83 MIN = 0Measurement = 1799 cm.Reading = 37 MAX = 83 MIN = 0Measurement = 1799 cm.Reading = 38 MAX = 83 MIN = 0Measurement = 1849 cm.Reading = 36 MAX = 83 MIN = 0Measurement = 1749 cm.Reading = 37 MAX = 83 MIN = 0Measurement = 1799 cm.Reading = 83 MAX = 83 MIN = 0Measurement = 4099 cm.Reading = 34 MAX = 83 MIN = 0Measurement = 1649 cm.Reading = 37 MAX = 83 MIN = 0Measurement = 1799 cm.Reading = 80 MAX = 83 MIN = 0Measurement = 3949 cm.Reading = 38 MAX = 83 MIN = 0Measurement = 1849 cm.

int Reading = a2dConvert10bit(value);

int Reading = a2dConvert8bit(value);

long int Reading = a2dConvert10bit(value);

Reading = 8 MAX = 31 MIN = 0Measurement = 349 cm.Reading = 8 MAX = 31 MIN = 0Measurement = 349 cm.Reading = 9 MAX = 31 MIN = 0Measurement = 399 cm.Reading = 5 MAX = 31 MIN = 0Measurement = 199 cm.Reading = 9 MAX = 31 MIN = 0Measurement = 399 cm.Reading = 10 MAX = 31 MIN = 0Measurement = 449 cm.Reading = 9 MAX = 31 MIN = 0Measurement = 399 cm.Reading = 8 MAX = 31 MIN = 0Measurement = 349 cm.Reading = 8 MAX = 31 MIN = 0Measurement = 349 cm.Reading = 10 MAX = 31 MIN = 0Measurement = 449 cm.Reading = 7 MAX = 31 MIN = 0Measurement = 299 cm.Reading = 8 MAX = 31 MIN = 0Measurement = 349 cm.Reading = 7 MAX = 31 MIN = 0Measurement = 299 cm.Reading = 9 MAX = 31 MIN = 0Measurement = 399 cm.

Reading = 31 MAX = 32 MIN = 0Measurement = 1499 cm.Reading = 31 MAX = 32 MIN = 0Measurement = 1499 cm.Reading = 31 MAX = 32 MIN = 0Measurement = 1499 cm.Reading = 31 MAX = 32 MIN = 0Measurement = 1499 cm.Reading = 32 MAX = 32 MIN = 0Measurement = 1549 cm.System Warming Up.0 = 101.1 = 97.2 = 89.3 = 85.4 = 82.5 = 79.6 = 74.7 = 70.8 = 19.9 = 33.10 = 43.11 = 51.12 = 55.13 = 59.14 = 64.15 = 63Initialization CompleteReading = 19 MAX = 19 MIN = 0Measurement = 899 cm.Reading = 19 MAX = 19 MIN = 0Measurement = 899 cm.Reading = 20 MAX = 20 MIN = 0Measurement = 949 cm.Reading = 19 MAX = 20 MIN = 0Measurement = 899 cm.Reading = 19 MAX = 20 MIN = 0Measurement = 899 cm.Reading = 19 MAX = 20 MIN = 0Measurement = 899 cm.Reading = 20 MAX = 20 MIN = 0Measurement = 949 cm.Reading = 19 MAX = 20 MIN = 0Measurement = 899 cm.Reading = 19 MAX = 20 MIN = 0Measurement = 899 cm.Reading = 20 MAX = 20 MIN = 0Measurement = 949 cm.Reading = 20 MAX = 20 MIN = 0Measurement = 949 cm.Reading = 20 MAX = 20 MIN = 0Measurement = 949 cm.Reading = 20 MAX = 20 MIN = 0Measurement = 949 cm.Reading = 20 MAX = 20 MIN = 0Measurement = 949 cm.Reading = 20 MAX = 20 MIN = 0Measurement = 949 cm.Reading = 19 MAX = 20 MIN = 0Measurement = 899 cm.Reading = 19 MAX = 20 MIN = 0Measurement = 899 cm.Reading = 19 MAX = 20 MIN = 0Measurement = 899 cm.Reading = 19 MAX = 20 MIN = 0Measurement = 899 cm.Reading = 20 MAX = 20 MIN = 0Measurement = 949 cm.Reading = 20 MAX = 20 MIN = 0Measurement = 949 cm.Reading = 19 MAX = 20 MIN = 0Measurement = 899 cm.Reading = 19 MAX = 20 MIN = 0Measurement = 899 cm.Reading = 19 MAX = 20 MIN = 0Measurement = 899 cm.Reading = 20 MAX = 20 MIN = 0Measurement = 949 cm.Reading = 19 MAX = 20 MIN = 0Measurement = 899 cm.Reading = 19 MAX = 20 MIN = 0Measurement = 899 cm.Reading = 20 MAX = 20 MIN = 0Measurement = 949 cm.Reading = 19 MAX = 20 MIN = 0Measurement = 899 cm.Reading = 19 MAX = 20 MIN = 0Measurement = 899 cm.Reading = 19 MAX = 20 MIN = 0Measurement = 899 cm.Reading = 19 MAX = 20 MIN = 0Measurement = 899 cm.Reading = 20 MAX = 20 MIN = 0Measurement = 949 cm.Reading = 19 MAX = 20 MIN = 0Measurement = 899 cm.Reading = 20 MAX = 20 MIN = 0Measurement = 949 cm.

The readings were 7, 6 and 10, respectively. Yes, it went down from 15-30.