PIC output for piezo transducer

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

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC output for piezo transducer

Post by medelec35 »

Yes it's still v3, but the difference is if you use flowcode view, project options.
It should allow you to select 12F1840 as a target device.

Its always best to keep configuration settings in advance mode.
To do that select Chip from menu then configure.
Select options and make sure use simple config screen is unchecked.
Martin

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC output for piezo transducer

Post by christoph »

Hi Martin - I tried the progrmmed chip out but I get a tiny click every second or so and after a pause of approx 15 seconds I can just make out a VERY high pitched rising tone which then disappears until same thing after another 15 secs

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC output for piezo transducer

Post by christoph »

also - apologies as I had not realised your last post was there cos I didn't see the page 2 button!

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC output for piezo transducer

Post by medelec35 »

Hi Chris.
I found a transducer and connected it up to a different target device, and that woks ok, not how your description.

Have you done a 1 second flasher test. I guess you can use transducer instead of LED.
Make sure it clicks every 1/2 second as there could be something amiss with your configuration settings.

What are you setting osc speed to?
Martin

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC output for piezo transducer

Post by christoph »

Hi Martin,
Not sure how one implements the one second flasher test?
The oscillator speed is set to 8 meg and the clicks which I thought were about a second apart, probably ARE - as you say - about 1/2 second.
When I go to configure on flow chart, it shows 'simple - slot 2; the wrong chip and the 1840 is not listed and set to RC. I then select expert config and everything is DISABLED apart from "INTOSC oscilator (fine!) and Brown out reset voltage at 1.9 (only got choice of that or 2.5v anyway of course). Does show correct chip, as it does in view, project options.
I have used the i/o and o/p pins you said and I hadn't - to begin with taken the MCLR pin to pos via a 10k resistor but then having done so it made no difference. I have left the unused pins un-connected.
Not sure what I am doing wrong but there has to be light at the end of the tunnel since your set up is working.
Chris

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC output for piezo transducer

Post by medelec35 »

Just a thought.
When you changed target device, did you make sure pot on both simulator and hardware match up?

Does altering the pot change the rate of change?
When I tried, I could make it sound like a car alarm going off when running at a fast rate.

I will be altering flowchart to see if i can make improvements.
Martin

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC output for piezo transducer

Post by christoph »

Hi Martin, I have got a 100k pot and slowly rotated thro' the whole range backwards and forwards (so I guess I should have 'struck' the appropriate match) and I think it might have altered the rate of change but the very high pitch going up only lasts for second or two.
1. Should the simulator pot change the PWM graphic on the flowchart, as I dont get any change.
2. Have I set my config settings ok - virtually everything disabled?
3. Are you using a piezo disc transducer DIRECTLY connected to the output of the chip - mine goes into the same circuitry I have got for the original potted driver.
4. Are you in ageement with my chip connections?
4. The sound you are describing sounds right to me so great - just going to have another go with it now and try driving piezo direct

Chris

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC output for piezo transducer

Post by christoph »

Have just tried connecting the piezo and results are exactly the same.. This seems like something to do with my settings somewhere. The rising tone is so high it goes higher than the audible range and I think the long delay between the lowest frequency points is because the whole action is happening a long way into high freqency area. I will await your comments as I not sure how mine is not working as yours is.
Chris

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC output for piezo transducer

Post by medelec35 »

Not sure, perhaps if you post your flowchart, I can have a look at it for you.
Martin

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC output for piezo transducer

Post by christoph »

I copied it over into my Matrix file areas and the graphic does appear to be working and I guess the duty cycle of 50% is what is needed - anyway, here it is......
Sweep output 12F683 V1.fcf
(14.5 KiB) Downloaded 442 times

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC output for piezo transducer

Post by christoph »

Hi Martin,
Is it anything to do with the chip I am actually using i.e. the 1840?
Chris

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC output for piezo transducer

Post by medelec35 »

Hi Chris,
The only thing I can think of is PLL in configuration settings is enabled.
Can you try disabling it and recompiling.
If PLL enabled, and internal osc is set to 8MHz,then internal osc can run at 8 x 4 = 32MHz

Which is what i'm planing for a different version.
Just lack of time at the moment.

Martin
Martin

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC output for piezo transducer

Post by christoph »

Yep, I will have a go at that - I think it IS the very very high frequency MY arrangement (for one reason or another) is running at that is my problem and apart fom anything else it is naturally a long way from the resonant Fq of the piezo. I also know from experience that as frequency goes up with piezos the volume reduces very dramatically leaving aside the resonant Fq side of things. It is obvious from the graphs anyway.
Basically I'm sure your suspicions are correct. I need to address this whole issue of speed/timing as I havent needed to so far and I don't understand it at the moment but I also need to have an understanding for future projects. Only problem is finding time - we are all in the same boat, I know!
Best wishes'
Cheers,
Chris

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC output for piezo transducer

Post by christoph »

Hi anyone got any ideas why I get this failure when compiling - This previously compiled quite happily before and have only disabled some things in the config listing. I HAVE repaired the the MM v4 in 'computer' several times but no joy.
Any thoughts greatly appreciated
Chris


Starting preprocessor: c:\PROGRA~1\MATRIX~1\FLOWCO~1\boostc\pp.exe "Sweep output 12F683 V1.c" -i c:\PROGRA~1\MATRIX~1\FLOWCO~1\boostc\include -d _PIC12F1840 -la -c2 -o "Sweep output 12F683 V1.pp" -v -d _BOOSTC -d _PIC16 -d _PIC16x -d _CHAR_INDEX


.......

Sweep output 12F683 V1.c success

success

Return code = 0

Launching the linker/assembler...
c:\program files\matrix multimedia\flowcode v4\boostc\boostlink_pic.exe -ld "C:\Program Files\SourceBoost\lib" libc.pic16.lib "Sweep output 12F683 V1.obj" -t PIC12F1840 -d "C:\Users\dad\Documents\AI Matrix piezo" -p "Sweep output 12F683 V1"
BoostLink Optimizing Linker Version 7.03
http://www.sourceboost.com
Copyright(C) 2004-2011 Pavel Baranov
Copyright(C) 2004-2011 David Hobday


Error: Failed to open:libc.pic16.lib or C:\Program Files\SourceBoost\lib/libc.pic16.lib


failure

Return code = -2

Flowcode was unable to assemble the ASM file due to the following errors:


FINISHED

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC output for piezo transducer

Post by medelec35 »

Problem looks like the liknker boost c directory settings are wrong.

Can you click on Chip/Compiler options.
Then click on Restore Defaults.

If you look at:
http://www.matrixmultimedia.com/support ... f=22&t=683

That shows the correct paths.

You have got:
c:\program files\matrix multimedia\flowcode v4\boostc\boostlink_pic.exe -ld "C:\Program Files\SourceBoost\lib" libc.pic16.lib

The C:\Program Files\SourceBoost should be:
C:\Program Files\matrix multimedia\flowcode v4\boostc
etc.
Martin
Martin

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC output for piezo transducer

Post by christoph »

Ahh - thanks Martin - I have been trying various things to get it going but to no avail. Just come 'back to it'! I will follow your advice - many thanks, Chris

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC output for piezo transducer

Post by christoph »

Yes that allowed it to compile but it wont programme the chip and it comes up with this message:

Unable to transfer the Hex file using:
[INSTALLDIR]tools\PPP\PPPv3.exe-cs2-chip PIC12LF1840-nogui
"Sweep output 12F683 V1.hex
Check programmer location and options are correct


Is this another problem or if I follow the link you showed in your post, it should sort it?

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC output for piezo transducer

Post by medelec35 »

Hi Chris,
For that you need to see this:
http://www.matrixmultimedia.com/support ... f=22&t=612

Martin
Martin

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC output for piezo transducer

Post by christoph »

Hi Martin,
Just spent the time updating everything and tried to compile and it went back to the first problem and when I looked at what i had just put right it had reverted back to all the lower case stuff. Had to redo all those parameters cos default didnt do the job. I have just come back to the forum and I see your post so will check that out
HOW CAN THIS HAPPEN though? I have a feeling I have done something wrong when I did the PPPv3 update - maybe?

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC output for piezo transducer

Post by medelec35 »

christoph wrote:I have a feeling I have done something wrong when I did the PPPv3 update - maybe?
The PPP update was just copying and pasting.
Have you got anything else that uses boostC.
The [INSTALLDIR] can happen with some installations, so nothing you have done wrong.
The [INSTALLDIR] appeared because of the reset to defaults.
In a lot of cases that does not happen.
Martin

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC output for piezo transducer

Post by christoph »

Hi Martin - the trouble is I corrected that on the fly anyway but as I say it has just ignored all my corrections - how do I get it to 'stick'! The link just says when done press 'OK'
OK - I just checked and I restored to defaults and all the lower case stuff got corrected but it put back the [.....] 'thingy'. so hopefully I just need to correct THAT and might be ok.

Just reverting back to PPP, should I perhaps have deleted the re-titled old file? which I havent so far. I also see what you meant re v3 - it is v3.something!

I will let you know shortly if latest try is successful

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC output for piezo transducer

Post by christoph »

BINGO! - that sorted it and the chip programmed successfully.
Very useful bit of knowledge there.
Dont think I am going to get time to try chip tonight but with the PLL business probably the answer to the frequency problem (disabled) I am hoping tomorrow will bring the desired results - will let you know!

Many thanks for all that
All the best
Chris

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC output for piezo transducer

Post by christoph »

Just one other curiosity!....
AS THE PROGRAMMING OF THE CHIP NEARS COMPLETION IT comes up with a message to say the chip in the development board is not the same as the one on the flowchart etc and gives two options (the programming lamp is flashing in a waiting state). In this case it gives the 1840 I AM using and a PIC16F722A! If I autodetect using any of the several places that is possible inclucing PPP, it also comes up with the 722A! I would be interested if there was any explanation particularly as it is a '16' and not a '12'?

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC output for piezo transducer

Post by christoph »

Just run thro. config and re-programming and it happens every time. Have checked and everything else says 1840!

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: PIC output for piezo transducer

Post by dazz »

Hi
go to your ppp folder, place the following files somewhere safe ppp_config_data1 and ppp_config_data2 .
then place the attached file into your ppp folder and try again
let me know if it works ok

Regards
Dazz
ppp_config_data2.cfg
(226.41 KiB) Downloaded 372 times
ppp_config_data1.cfg
(25.24 KiB) Downloaded 387 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

Post Reply