Thermometer PIC code

Tony
Site Admin
Posts: 948
Joined: Tue Jul 24, 2012 8:05 pm

Thermometer PIC code

Post by Tony »

For anyone who wants to try tinkering with it, here is the ASM file for the PIC. Usual rules apply - you can do what you want with it as long as it's non-commercial.

Most of the code is safe to play with but don't modify the PWM settings unless you're measuring the current taken by the inverter and are prepared to switch off quick/replace the MOSFET.
As there was plenty of memory available it only uses loops where required, with much of it being linear and I hope easier to follow. Some of the comments will be out of date as things were tweaked later, or pasted from other sections and not modified. An example is the temperature smoothing, the comment still refers to *32 but one bit operation has been remmed out so it currently uses *16 as it settled faster and had little impact on the result.
.
.
.
Attachments
nixitherm piccode.zip
(10.37 KiB) Downloaded 1722 times
alex
Posts: 4
Joined: Wed Apr 17, 2013 1:23 am

Re: Thermometer PIC code

Post by alex »

Thanks for uploading the code!

I guess I will have to learn more about assembly language ( I'm more familiar with C).

What compiler are you using with this code?
Tony
Site Admin
Posts: 948
Joined: Tue Jul 24, 2012 8:05 pm

Re: Thermometer PIC code

Post by Tony »

Just the standard MPLAB IDE software with a PICKIT3.
Tony
Site Admin
Posts: 948
Joined: Tue Jul 24, 2012 8:05 pm

Re: Thermometer PIC code

Post by Tony »

The code posted above is intended for a PIC16F1847 as originally used, the current kits use an 1827 and I've attached the latest version of the code for use with these. The only difference is the loaction of the saved display state has been fixed.
Attachments
1827 therm piccode.rar
(9.69 KiB) Downloaded 1444 times
Tony
Site Admin
Posts: 948
Joined: Tue Jul 24, 2012 8:05 pm

Re: Thermometer PIC code

Post by Tony »

The AM2302 sensor is a more accurate substitute for the DHT11 but the data is formatted slightly differently. This is a modified hexfile you can try out if you want to upgrade the current sensor(s) and improve the humidity accuracy.
Attachments
AM2302 sensor code mod.zip
(3.85 KiB) Downloaded 1283 times
Tony
Site Admin
Posts: 948
Joined: Tue Jul 24, 2012 8:05 pm

Re: Thermometer PIC code

Post by Tony »

And of course a version which should detect and process either a DHT11 or AM2303. The detection may or may not be 100% so consider it V0.1 ;)

(it depends on both LSBs of temp and humidity having a non-zero value)
Attachments
Dual sensor code mod.rar
(3.66 KiB) Downloaded 1406 times
alex
Posts: 4
Joined: Wed Apr 17, 2013 1:23 am

Re: Thermometer PIC code

Post by alex »

Hi,

I would like to try the dual sensor mod but my nixie thermometer have the pic16f1847. Can you upload an hex file for the pic16f1847.

Thank you!
Tony
Site Admin
Posts: 948
Joined: Tue Jul 24, 2012 8:05 pm

Re: Thermometer PIC code

Post by Tony »

This should work:
2x IN-12 pod piccode.rar
(3.66 KiB) Downloaded 1375 times
alex
Posts: 4
Joined: Wed Apr 17, 2013 1:23 am

Re: Thermometer PIC code

Post by alex »

Yes, it work great! I get more accurate values with am2302 sensor.

Thanks again.
Tony
Site Admin
Posts: 948
Joined: Tue Jul 24, 2012 8:05 pm

Re: Thermometer PIC code

Post by Tony »

Just in case you can't compile the original .ASM file I've attached the final .hex to this post.
Attachments
Therm 1827 hexfile.rar
(3.53 KiB) Downloaded 1020 times
Post Reply