Multi-Geiger

For stand-alone microprocessors

Multi-Geiger

Postby Doug Coulter » Sat Jan 01, 2011 6:31 pm

This is the code for the multi-geiger project we did here. It uses one of our "log" boards, with a 18f6520 PIC on it, my opsys, and some other parts to create a thing that powers and counts up to 5 counters (one is hardwired for a geiger tube, the others are assumed phototubes and the other polarity), and digitizes 4 a/d inputs. It pushes the results of the a/d's out once per second on RS-232, and the geigers out when the periods end, usually we are using 10 seconds and multiplying by 6 to get cpm here. The output is human readable ascii, and we use a perl script described elsewhere to put it into a dababase for later use, and also on STDOUT during a run so you can see it all in one convenient place. Our implementation uses a LCD display and a rotary/push encoder for a local user interface to set things up.

This is all done using the CCS compiler and IDE on windows in virtual box on a linux machine...other compilers will require some pretty significant changes in the coding. We like the CCS as the best price/performance pic compiler for the 18 series, the HiTech one (which I think was bought out by microchip) really stank and cost twice as much anyway, though their 16 series was the best, go figure. But all these let you get so close to the metal, there's always going to be some code rewritten when you port, as things like how do they dispatch interrupts and such are very different between them. CCS makes linking separate files hard, and mixing in asm harder (because of the linking restrictions) but makes using their interrupt dispatcher easy, and it's good enough for all we do with it, so...that's what we use. Further, they provide examples -- tons of drivers for most of the common chips like eeproms, I2C stuff, you name it -- except the drivers for the commmon lcd display, which you'll find in this code -- we manage to write it so it handles "both" types of LCD controller -- seems one of the manufacturers read the spec one way and all times have to be slower than that, and the other the other way, so all times have to be faster than that...that was one PITA to make work with whatever LCD you buy surplus, but we managed. You might also want to "steal" what we think is the coolest, shortest, most accurate rotary encoder driver on earth, which "does the right thing" even with a noisy bouncy mechanical encoder....

MultiGeiger.zip
Zip of multigeiger files
(246.11 KiB) Downloaded 734 times


As was the norm, I started this project, than handed it to Dave K to finish it, just in case you notice more than one coding style in there -- that's the reason.

I hope you'll consider this GPL-2 code and if you make any decent improvements, re-post them here so we can all benefit too. Pics are easy and fun to program once you have a nice place to begin like this. This code uses the built in serial port driver, which is blocking, as we got the rest of the critical timing done so it doesn't matter about that, for a newer better version of the basic opsys, look on another thread here.
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA

Return to Embedded software

Who is online

Users browsing this forum: No registered users and 2 guests

cron