Geiger Counter

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
emrekaya
Posts: 7
Joined: Thu Aug 02, 2007 8:13 pm

Geiger Counter

Post by emrekaya »

Hi Guys.

I am designing a geiger counter with flow code. My Problem is the math functions. The tube's response for CPS (count per second) to MRad/Hr is as follows:

e^((Ln(y)-2.8903)/0.912)=x rad/hr as you can see i need epow and ln operators and i couldn't find a way to solve this problem in Flow Code (floating is also needed.. yep.). Are there any math libraries designed for Flow Code pic or should i buy AVR version with a programmer and redesign :D.

TMR0 is used for a full sec count as frequency can never be larger than 10khz and i have a nearly whole second empty processor time :D

y ranges from anywhere between 1 to 10 khz so a table is not an option. I also tried to linearize the function splitting the counting zones but this also resulted in more than 100 zones :D + lots of if sub branches.

Anyone can suggest me a solution with epow ln libraries ?


WISH LIST:

1. Please add math functions as macro to the next version of flow code. I know they will be long and slow but better than none.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Geiger Counter

Post by Benj »

Hello

You might be able to do this with the PIC floating point librarys. Refer to this forum topic for more information.

http://www.matrixmultimedia.com/support ... .php?t=505

It might be easier to do this as a look up table though, this way you will not need such large calculations to work out the result.

See here for an example using look up tables.

http://www.matrixmultimedia.com/mmforum ... =26&t=4869

emrekaya
Posts: 7
Joined: Thu Aug 02, 2007 8:13 pm

Re: Geiger Counter

Post by emrekaya »

Than you very much for the floating lib.

After a day break I reopened my collage books on math theory :D

For people having the same problems :

With the use of Taylor series to calculate ln x in a pic environment is quite possible. All depends on the accuracy. Following links are from wiki :D
They define the workings of ln operation.

ImageImage
Image

logx(y) can also be calculated as ln(y)/ln(x)=lnx(y) (Much more clock power)

Power is also not supported so x^n routine will be basically: (more clock power )

loop for y=0 to y=n
x=x*x

i saw a pic math co processor in a 5 year old archived parallax.com web page during my search. No longer available. actually it seems that there are none.
May be an add on module program block will be a good addition to flow code..(math support module)

Like : Choose your routines tan sin log ln ( define the power calculation duration requirements and etc as it should be kept in a reasonable time period) Upload them to a separate pic and let it make the calculations and return the values trough serial parallel interface.
or make it create a real time look up table

Post Reply