RF Detector

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

don854
Posts: 5
Joined: Sat Apr 26, 2014 11:35 am
Been thanked: 1 time
Contact:

RF Detector

Postby don854 » Mon Jun 02, 2014 10:44 am

Hello all,

I have constructed a project which converts the DC voltage from a RF detector circuit to ADC counts using a PIC16F876 and displays the counts as RF power in -dBm and a Bar graph representing signal strength on a LCD. Initially in the calculator block I just put in simple calculations such as RFPower=(ADCReading -1023)*45/716 and Bars=45/(0-RFPower) whilst I completed the rest of the project. Once all finished I calculated a equation from the plot of RF power vs counts and came up with RFPower=(ADCReading*0.0571-83.2972), Bars=400/(0-RFPower). With these equations placed in the calculator block simulation worked fine but when the micro was programmed the RF detector stopped working all the LCD display did was stay on one number and not display any bars, number was random any help greatly appreciated. Also I admit I did plagiarise the Bar graph program.

Regards,

Don :oops:

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8334
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2382 times
Been thanked: 3393 times
Contact:

Re: RF Detector

Postby medelec35 » Mon Jun 02, 2014 1:29 pm

Hi Don,
Welcome to Matrix forums.

It's always helps if you can post a flowchart, and let us know what version of flowcode you have got (Help, About Flowcode)
If it's commercially sensitive then someone may be able to PM you about that.

don854 wrote: Also I admit I did plagiarise the Bar graph program.

If it is from a flowchart that I had posted then I don't mind at all!

Martin
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 381 times
Been thanked: 714 times
Contact:

Re: RF Detector

Postby JohnCrow » Mon Jun 02, 2014 6:30 pm

Hi Don
Sounds an interesting project.
What hardware are you using for the RF detector?
1 in 10 people understand binary, the other one doesn't !

don854
Posts: 5
Joined: Sat Apr 26, 2014 11:35 am
Been thanked: 1 time
Contact:

Re: RF Detector

Postby don854 » Tue Jun 03, 2014 9:51 am

Apologies couldn't figure out how to attach the flowchart. I'm using Flowcode 4.5. Hardware used is the following;
Gali-39 RF Amp
MAX4003 RF Detector
LM358 Signal conditioning-Peak detector and non-inverting amp
MCP73831 LI-ION Battery Charger and
Pololu U3V12F9 DC/DC converter

The detector is designed as a handheld device that's the reason for the MCP73831 and the DC/DC converter is for the RF circuit.
How do I attach the Flowchart?
Don
Attachments
Phone Detector.fcf
Don't know how I missed that.
(11 KiB) Downloaded 325 times
Last edited by don854 on Wed Jun 04, 2014 9:00 am, edited 1 time in total.

don854
Posts: 5
Joined: Sat Apr 26, 2014 11:35 am
Been thanked: 1 time
Contact:

Re: RF Detector

Postby don854 » Tue Jun 03, 2014 9:55 am

medelec35 wrote:Hi Don,
Welcome to Matrix forums.

It's always helps if you can post a flowchart, and let us know what version of flowcode you have got (Help, About Flowcode)
If it's commercially sensitive then someone may be able to PM you about that.

don854 wrote: Also I admit I did plagiarise the Bar graph program.

If it is from a flowchart that I had posted then I don't mind at all!

Martin

Apologies how do you attach the flowchart?

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

Re: RF Detector

Postby Benj » Tue Jun 03, 2014 10:03 am

Hello,

When creating/editing a post there is a tab below the main text entry field which states "Upload Attachment", click on this for options to attach a file to the post.

don854
Posts: 5
Joined: Sat Apr 26, 2014 11:35 am
Been thanked: 1 time
Contact:

Re: RF Detector

Postby don854 » Sat Jun 07, 2014 2:48 pm

I might have confused people with my original post so I will hopefully make my problem more clearer. The flowchart attached is almost similar to the original except for the calculator block which has the equation for counts to RF power this flowchart compiles and simulates ok. But when running on the EB006 and LCD board is stays on a ridiculous number such as 18986dBm no negative sign and will not change when counts are changed including the bar graph, I have tried changing variables to floats string manipulation nothing works when I revert to the original flowchart no problems hardware works fine. So I'm fairly confident in saying the hardware isn't the problem the micro just doesn't like linear equations I'm confused. The original flowchart is very inaccurate more than 20dBm error.
Attachments
RF Det.fcf
Modified flowchart
(11 KiB) Downloaded 300 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8334
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2382 times
Been thanked: 3393 times
Contact:

Re: RF Detector

Postby medelec35 » Sat Jun 07, 2014 5:12 pm

Hi Don.
The problem with your flowchart is with the type of variable you're using for calculations.
for instance an Integer is being used, and they are whole numbers only. You can't use any decimal point as thy will be completely ignored and whole part will be rounded down.
e.g 0.999 * 1023 +10
= 0 * 1023 + 10
=0+10
=10
The range of integer (its a signed integer to be precise) is -32678 to 32767
So with using only whole numbers, you will loosing accuracy.

The only way you can use decimal numbers like 0.999 is by using float variables.
They are not really recommended for the older 16F range pics due to taking up loads of ram and 32bits of rom so you will be running out of memory very quickly.
It not all doom as I have modified your flowchart to work on hardware.
With pot reading 0V then display should show -83.4dBm
With pot reading 5V then display should show -24.8dBm
If you want the range to be different then let me know.

THe other thing to mention is when using integer calculations do not go over the integer range of -32678 to 32767
E.g 1023 * 32 is allowed as that will = 32736
1023 * 33 is not allowed as that will -31777 since the result is larger than the allowed 32767 the number has rolled over.
Hence the random looking numbers you're experiencing

Martin
Attachments
RF Det V2.fcf
(11.5 KiB) Downloaded 331 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

don854
Posts: 5
Joined: Sat Apr 26, 2014 11:35 am
Been thanked: 1 time
Contact:

Re: RF Detector

Postby don854 » Fri Jun 13, 2014 9:03 am

Thanks medelec35,

My intentions were to make the variables floating it's because I couldn't get the flowchart to work that I used integers for ease. I didn't realise I was going over range, had a feeling it was something simple I'm better with hardware than software. The flowchart worked fine all tested fine.

Cheers Don
These users thanked the author don854 for the post:
medelec35 (Fri Jun 13, 2014 1:16 pm)
Rating: 5.56%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8334
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2382 times
Been thanked: 3393 times
Contact:

Re: RF Detector

Postby medelec35 » Fri Jun 13, 2014 1:15 pm

Hi Don,
don854 wrote: didn't realise I was going over range

That happens fairly often and can take the more experienced by surprise.
Thanks for updating us as forum users like to find out what the end result was..

Martin
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.