- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
After the 400th time I wrote the same project to test something simple with the ADC and put the result on the LCD, I decided to make a component to simplify things. This component does everything you would need to do to sample the ADC and display the result on the LCD, a standard practice when learning and debugging.
I added some common features:
1.) automatic sampling, just all Easy_ADCToLCD_Start() and you are done. (blocking forever, great when you just want to do something really simple)
2.) built in averaging (filtering) of the samples to smooth out any noise. the size of the average is adjustable
3.) a "transfer function" that allows you to convert the voltage into another unit, say current or ohms. you can specify any C equation to convert the voltage from the ADC into anything else, includes units.
4.) uses 32 or 16 bit get result API so it can be used with the DelSig or the SAR
5.) Just put in the name of the ADC and the LCD and the component takes care of the rest for you.
its a simple component, but I really like how it simplifies my life. The concept could be extened to anything really, like sending the data out to a UART ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Very handy 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I cannot get the testbench to work, what do I have to do to make it run? The component does not show up.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Found it! You had an archive archieved into an archive.
And I found a programming flaw ! You wrote in main() line 97
i = ++i %16;
which is flagged as a warning by GCC (Yes, I changed the devive to PSoC5)
Generally you should avoid having the same var as LValue and modified on the right side of the equal sign.
Have a look into a manual here http://publications.gbdirect.co.uk/c_book/chapter8/sequence_points.html
In your case the assignment would probably work, but this is a target for unpredictable result when altered.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi to all!:
How can I use it? I mean what files and where should I but them.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The very first post in this thread by Chris contains a link to a downloadable archive. There you get it from.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Made a small modifcation to split the I = ++i % FILTER_SIZE; into to lines. New Archive posted here (hopefully the forum will allow me to attache a .cycomp file this time)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
Can I use it with PSoC 5LP??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is a pure software component, no reason why it should not run on any PSoC.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey! Thanks for using the component. The problem is that at some point they changed "device.h" to "project.h" I need to update the component with that fix.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Still givning the error Unable to open the file for reading. Could not find file 'E:\Documents and Settings\bob\My Documents\cypress\New Folder\EasyADC_to_ADC\EasyADC_to_LCD.cylib\KEES_EasyADC_to_LCD_v1_00\API\EasyADC.h'. . Where do I place the new file in the main library or some where else?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unzip the file and inside there should be a .cycomp file. Open a new creator project, and go to the "components" tab (in the workspace explorer). Right click on your project name and select "import component". In the dialog box that pops up, select "import from archive" and navigate to the .cycomp file you extracted. Click "OK" and you should now have a copy of the component in your project. open you project schematic and place the component along with the ADC and LCD component. Assign pins, write main.c and try to build. Let me know what happens.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I moved the library to a new folder and downloaded it again. blew away the old dep and made a new dep and get this error again. ./Generated_Source/PSoC4/KEES_EasyADC_to_LCD_1.h:19:20: fatal error: device.h: No such file or directory
Thnaks Bobgoar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I now am getting closer. I just made a blank device .h file and that fixed that error about the device h issue . Now I am getting an error in EasyADC_to_LCD.c at line 91 Build error: too few arguments to function 'ADC_1_GetResult16' and line 97 operation on 'i' may be undefined [-Wsequence-point] and line 110 Build error: too few arguments to function 'ADC_1_CountsTo_Volts' I do not know if I need a math function turned on or what is the cause fo these errors.
Bobgoar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Don't you need to have a #include project.h in that file ?
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have got both components, the old and the new one. Remove the old version 1.00 and include the new version 1.1
When setting the properties, disable the transfer function, it contains references to math.h which you probably do not want.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did not seem to need the .h file all the project .h file has all the includes but it would not compile with out the empty file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I checked for the enable transfer function it is turned off. Still getting error of Build error: too few arguments to function 'ADC_1_CountsTo_Volts' at line 104 in EasyDac_to_lcd.c file/
Bobgoar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CountsToVolts() needs the channel number as the first parameter and there is no GetResult32(), only a GetResult16().
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bob is correct.
The Easy ADC to LCD component was created before the SAR sequencer existed and so it is was not aware of the different parameters that need to be passed in order to get a result from the GetResult() API. That is why it is complaining about too few arguments passed to GetResult() and CountsToVolts(). Its expecting a channel number and my component isn't providing one.
I went ahead and updated the component to work with these sequencing ADC's (new parameters added) as well as adding a few other feautres.
Remove all other versions of the component from you projects / libraries and use this one. I have updated the revision number to v1.1 and updated the datasheet as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This part of program is generated by the easyadc_to_lcd library so where do I change it in the lib to get it to produce the correct files in the program?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This part of program I will try the new library.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is no need to modify it. I posted an updated version of the component (see 3 posts up)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I must be missing something here. I added the component to the easy adc to lcd library and it appears to be the same one I had . I do not know how to get this new component into my design. What am I missing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First, remove all previous versions of this component from your library. Then, import the new component into your library.
When you place the component and open the customizer, do you see an "AutoSample" parameter? If you do, then you have the latest version. If you do not, create a new, blank project, and import the latest component into that project as I described earlier.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Chris
"This is the curse of every good deed". Just creating a new component, giving it to the public and then... new devices pop up, new Creator versions appear and the adaption of the old-fashioned component consumes the last bit of leisure time... 😉
Thank you!
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your help Chris and Bob I finally got the item to compile and again Thanks so much. Have a Merry Christmas and Happy New Year.
Bobgoar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Bobgoar
Are you not working the next days? Early start of celebrating christmas?? Cool!!!
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I could not make the component to work. For some reason after the function :
sprintf(szBuffer,"%0.4f v ", ADC_SAR_Seq_CountsTo_Volts(0, temp));
is executed the value in szBuffer stays 0x20;
When I print out temp the value is right.
Could anybody help me with this problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you using PSoC 5LP and the latest version of creator? If so, it might be related to the heap size. Check out the posts in this topic for more info: http://www.cypress.com/?app=forum&id=2492&rID=76890
" Just a note for making this work with Creator 3.1 for PSoC 5LP.
Add the linker flag -u _printf_float by going to Project -> Build Settings -> Linker -> Command line. This will add floating point support for sprintf.
You will also need to increase the heap size in the .cydwr file under the Systems tab. A size ov 0x0800 should be fine. This gives the sprintf function room to work."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@kees: since this seems to be a common problem now: maybe the default heap size should be increased again (I even encountered it in the BLE project created from a template...)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Where is the system tab to change the heap size located?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
open the Cydwr file in your workspace explorer (this is where you normally set you pin locations) and along the bottom there are tabs. This is where you find the system tab.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks I was looking all over for the system tab and it was right in front of me all the time in the center of the Psoc creator screen.