Hi ! Me, again :)
Please, how to addapt Melanie's great pice of code (post#^6) for only 5 readed values, not 10 ?
Thanks !
I prefer the inductor on the +Vdd side.
Anyway, I'd suggest get 10 or more samples in an array, then sort them in order and keep the middle 5 values.
Then add them together and divide by 5.
...
Yes, the LATD.1 = 1 has to be set as there is no telling what state it was left in after the preceding OWOUT command.
Dave - 13th February 2019, 15:08won't statement HIGH DIGIT1(2) set HIGH the port number, stored in DIGIT1(2) ?
CuriousOne - 13th February 2019, 14:29Excellent!
now it works!
so it was latd/trisd issue as I guess...
Within PBP you can manually manipulate SFRs, read and write to UART registers, etc. If the PIC you are using has EEPROM, you can set up an array of sequential EEPROM addresses with SFR settings. It...
mpgmike - 12th February 2019, 16:34Try this routine:
OWOUT DQD, 1, [$CC, $44] ' Start temperature conversion
LATD.1=1 SET PIN STATE TO HIGH
TRISD.1 = 0 'MAKE PIN AN OUTPUT WITH DEFAULT STATE HIGH
pause 760 'ADD AN EXTRA 10...
CuriousOne, How many times are you letting the program cycle? Here is the output from my terminal after I reset the processor power. Notice the "85" as the first reading from the DS18B20-PAR. This...
Dave - 12th February 2019, 16:02YUP it wasn't OSCCONx per se, but you got me thinking and it WAS the Configuration Word Settings. I had (erroneously) assumed that by setting INTOSC at 32MHz, no other config word settings would be...
picster - 12th February 2019, 13:47
Re: Stable Adc Reading Routine
That code gets 16 samples not 10. You just have to limit the samples from 16 to 5. But this is not very useful. Leave it as it is for ironing out the noise or parasites in the signal.
Ioannis Yesterday, 21:50Ioannis