NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Support Forum » Attempting to run another code for tempsensor
October 07, 2011 by nerdgirl |
Hello Everyone, I have revised my tempsensor code to display a real-time clock. My question is once I created it in Programmers notepad, how does the "makefile" decipher which code to make? Take a look. How do I get it to "make" realtimeclock1.c file? |
---|---|
October 08, 2011 by Ralphxyz |
Nerdgirl, re: [quote] how does the "makefile" decipher which code to make? [/quote]. The makefile only does what you tell it to do. Actually it's the compiler not the makefile that does any thing, but the compiler follows the instructions of the makefile, guess why it is called a "make"file. Now if you use my suggestion from your other thread you would just change ProgramName = realtimeclock1 in your makefile in the realtimeclock1 folder. Of course you have to be in the realtimeclock1 folder. Ralph |
October 09, 2011 by nerdgirl |
Hi Ralph, Thanks again. I have taken your input and changed the makefile to realtimeclock1. I also made a folder for it. Wish me luck. :-) |
October 09, 2011 by nerdgirl |
Hello, When I did as instructed,(changed the makefile) to realtimeclock1 in various places, I'm still getting the old code displayed on the LCD. I'm attempting to revise the tempsensor code so that it will have a real clock displayed while giving the temperature. Right now for the tempsensor project, my LCD reads: ADC value: 983 of 10 Temperature: 480.95 (of course these numbers vary) On the last two lines it reads 24 F I would like to know what this means and to display a clock with the reading. Thanks. |
October 09, 2011 by Ralphxyz |
Lets see a screen shot of you folder/directory layout. Then post you makefile, use the "Indent Selection as Code Block" button so that we can read your make file. This is bothersome [quote] When I did as instructed,(changed the makefile) to realtimeclock1 in various places,[/quote] If you did as instructed you only needed to change realtimeclock1 in one place, should be line 6 if you used my makefile example. Ralph |
October 09, 2011 by nerdgirl |
Didn't mean to quote a "bothersome" quote. I've changed line 6 of my makefile to "realtimeclock1-upload" and left the rest of the makefile alone. I made a folder (realtimeclock1) where tempsensor_edu is, and when I click on realtimeclock1 folder it shows: MakeFile, realtimeclock1.c, realtimeclock1.hex, and realthimeclock1.0 I'm giving a description of what my folder entails simply because it is quicker. But if you still need to see a screenshot of the description of my realtimeclock1 folder, let me know. Thanks. |
October 09, 2011 by nerdgirl |
Hi Ralph, Just changing line 6 of the "makefile" doesn't seem to work. I will Google this problem. Thanks for your help. |
October 09, 2011 by nerdgirl |
Here is the screenshot of my "realtimeclock1" folder setup. I hope this helps. |
October 09, 2011 by nerdgirl |
And here is what's inside the "realtimeclock1" folder. Let me know if this helps. Basically, I'm trying to run a new code that will display the time and temperature. I've changed line 6 of my "makefile" to the new program (realtimeclock1) How can I get the realtimeclock1.c to compile? Thanks to everyone in advance.
|
October 10, 2011 by Ralphxyz |
Lets see your makefile. [quote] I've changed line 6 of my makefile to "realtimeclock1-upload" [/quote] That is wrong!!
This time it is line 7 you change! ProgramName = initialload That and the com port are all you need to change! Does the realtimeclock1 project run? It looks like it compiled. Have you compiled and ran the realtime clock project before making modifications? Ralph |
October 10, 2011 by nerdgirl |
Ralph, Every where the "makefile" has the $(Programname) I changed it from tempsensor to realtimeclock1. I'm confused as to why I would only change line 7 and not the places your make file code has $(Programname). Otherwise the "makefile" reads "tempsensor" elsewhere. Would you please explain? I have not been able to complie realtimeclock1. My serial port is COM2. Thanks. |
October 10, 2011 by hevans (NerdKits Staff) |
Hi nerdgirl, Ralph is doing a great job is helping you with the Makefile (thanks Ralph!). I wanted to jump in here for a sec because in your screenshot from 1 day ago I can see a .hex and a .o file which means your realtimeclock1.c code was in fact compiled and turned into a .hex file ready for upload to the computer. Perhaps the error occurred afterward during the upload process, could you let us know exactly the error you are getting? Humberto |
October 10, 2011 by nerdgirl |
Hi Humberto, The hex and the .o file were just simply renamed from tempsensor to realtimeclock1 because I thought that's what I needed to do. They are files just copied from tempsensor. The error message that I'm getting when I run the "makefile' for realitimeclock1 is: |
October 11, 2011 by Ralphxyz |
Nerdgirl, show us your makefile, use the "Indent Selection as Code Block" button!! Ralph |
October 12, 2011 by nerdgirl |
Ralph, Since I don't know how to use the button yet to post code, I decided to simply show you an image of my makefile for realtimeclock1. |
October 12, 2011 by nerdgirl |
Ralph, I will eventually learn how to use the "Indent Selection as Code Block" button. Sorry for the inconvenience. |
October 12, 2011 by Ralphxyz |
Well, you quickly learned how to post an image. To use the "Indent Selection as Code Block" button you first have to understand what the heck it means to Indent and why. The answer lies down towards the bottom of this very page. Amongst the instruction on how use the "Markdown Syntax" is: Code Block - to put a code block into your post simply precede every line in the code block with at least four spaces. You would use this method to insert code or in this case your makefile, every line would be proceeded by four spaces. This places the literal text into your post. You would not believe the whining that Mike and Hmberto had to endure before they finally automated this process with the "Indent Selection as Code Block" button. So now all you have to do is to copy your makefile from your editor and paste into the post text window and then "Highlight" (select) your posted text and click the button. Voila, that's it your code now appears in a easily readable and copyable form in your post. Now onto your makefile it looks like you have been messing around with it deleting flags and changing things. I think we should start at the beginning. First thing what do you "think" a makefile does? You do not have to get into the deep specifics of a makefile but just in general what does a makefile do? What is it's purpose? You could probable spend the rest of your life learning the specifics of a makefile but for now what does it do? Now lets look at the initialload and tempsensor makefile.
I would start over using the initialload makefile. You have had initialload working, have you gotten tempsensor to load and run? Have you gotten the Real time Clock project to run? You should have the tempsensor and RTC projects running before you try to combine them. Using ProjectName (ProgramName, Target or whatever):
To use this makefile for the tempsensor project just just move the # from line 9 to line 8!! That's all you have to do essentially just change the ProjectName ='s.
You can use the same makefile for all of your projects just by changing the ProjectName! You can just copy and paste these makefiles but you have to make sure tabs are used and not spaces!!
Start over with a new makefile and lets see how you do. Ralph |
October 13, 2011 by nerdgirl |
Ralph, here is my tempsensor makefile. In my next post I will post my realtimeclock1 makefile. GCCFLAGS=-g -Os -Wall -mmcu=atmega168 LINKFLAGS=-Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt -lm AVRDUDEFLAGS=-c avr109 -p m168 -b 115200 -P COM2 LINKOBJECTS=../libnerdkits/delay.o ../libnerdkits/lcd.o ../libnerdkits/uart.o all: tempsensor-upload tempsensor.hex: tempsensor.c make -C ../libnerdkits avr-gcc ${GCCFLAGS} ${LINKFLAGS} -o tempsensor.o tempsensor.c ${LINKOBJECTS} avr-objcopy -j .text -O ihex tempsensor.o tempsensor.hex tempsensor.ass: tempsensor.hex avr-objdump -S -d tempsensor.o > tempsensor.ass tempsensor-upload: tempsensor.hex avrdude ${AVRDUDEFLAGS} -U flash:w:tempsensor.hex:a |
October 13, 2011 by nerdgirl |
Here is my realtimeclock1 makefile. GCCFLAGS=-g -Os -Wall -mmcu=atmega168 LINKFLAGS=-Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt -lm AVRDUDEFLAGS=-c avr109 -p m168 -b 115200 -P COM2 LINKOBJECTS=../libnerdkits/delay.o ../libnerdkits/lcd.o ../libnerdkits/uart.o all: realtimeclock1-upload realtimeclock1.hex: realtimeclock1.c make -C ../libnerdkits avr-gcc ${GCCFLAGS} ${LINKFLAGS} -o realtimeclock1.o realtimeclock1.c ${LINKOBJECTS} avr-objcopy -j .text -O ihex realtimeclock1.o realtimeclock1.hex realtimeclock1.ass: realtimeclock1.hex avr-objdump -S -d realtimeclock1.o > realtimeclock1.ass realtimeclock1-upload: realtimeclock1.hex avrdude ${AVRDUDEFLAGS} -U flash:w:realtimeclock1.hex:a |
October 13, 2011 by nerdgirl |
Ralph, As I said previously, why would I only change line 7 when as you can see in my tempsensor makefile, tempsensor (the program name) is written throughout the makefile. So, that's why in my realtimeclock1 makefile I simply copied what is in the tempsensor makefile. |
October 13, 2011 by Ralphxyz |
Yeah, but you made other changes. For instance look at your com port, from your screen shot above you have:
You also have missing flags. Slow down and start over. I would suggest using the ProjectName method so that you do not have to touch anything else just the ProjectName. So far you appear to have more changes then intended, well I do not know if they were intentional or by accident regardless they were wrong. You have guessed at other changes like renaming the .hex and .o files without thinking about what you were doing just guessing it appears that you might be guessing about making changes to your makefile. Now have you had the tempsensor project and the real time clock projects compiled and running on your NerdKit? What you want to do is to combine both projects so have you had them running as separate projects? Ralph |
October 13, 2011 by nerdgirl |
I have been running them as separate projects. The tempsensor works just fine. It's the realtimeclock1 project that I'm having trouble compiling. Anyway, I'm about to give up on that one all together especially since all the other projects compile just fine. For now, I will start over and use the ProjectName method as you have mentioned. |
October 14, 2011 by Ralphxyz |
The original realtimeclock or your combined code? You'd think well this project runs and this project runs so I should be able to put them together, but it just ain't that easy. Especially when you are just starting out you have to compile every time you change a single line or add a line. It is a slow process when you are learning on your own, of course the next project is faster because you have learned what works and what doesn't. You can certainly combine the tempsensor and the RTC but doing it a line at a time and then compile will be your fastest way of doing it. Guessing and trial and error will eventually take longer and discourage you. I am glad you have the projects running I was getting worried that you were hung up and not progressing. Let us know how you are doing. Ralph |
October 14, 2011 by nerdgirl |
Hi Ralph, I started over on my makefile. Here, I changed only line 6 to realtimeclock1. When I tried to compile the program I received an avrdude error of which I will post next. By the way, how do you get the line numbers to post? GCCFLAGS=-g -Os -Wall -mmcu=atmega168 LINKFLAGS=-Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt -lm AVRDUDEFLAGS=-c avr109 -p m168 -b 115200 -P COM2 LINKOBJECTS=../libnerdkits/delay.o ../libnerdkits/lcd.o ../libnerdkits/uart.o all: realtimeclock1-upload tempsensor.hex: tempsensor.c make -C ../libnerdkits avr-gcc ${GCCFLAGS} ${LINKFLAGS} -o tempsensor.o tempsensor.c ${LINKOBJECTS} avr-objcopy -j .text -O ihex tempsensor.o tempsensor.hex tempsensor.ass: tempsensor.hex avr-objdump -S -d tempsensor.o > tempsensor.ass tempsensor-upload: tempsensor.hex avrdude ${AVRDUDEFLAGS} -U flash:w:tempsensor.hex:a |
October 14, 2011 by nerdgirl |
Here is what happened when I changed only line 6 of the makefile. |
October 14, 2011 by Ralphxyz |
Now Nerdgirl, STOP you have gone beyond my being able to say slowdown now you have to just stop. Look at what you posted!!
When I was saying to change line 6 (or line 7) that was in conjunction with using the ProjectName identifier.
You are not using the ProjectName identifier so changing just line 6 is silly (hopefully you know how to laugh at yourself, if not you will soon learn). Here is your makefile using the ProjectName identifier:
If you highlight and copy this you have to replace all of the [TAB] markings with literal TAB's. Copy and paste turns the tabs into spaces which cause errors when you compile. Again to get the line numbers you use the "code block" syntax (4 spaces), look at the instructions on the bottom of this page. Just copy your text, paste it into the forum post window highlight it and push the button. Using a code block makes reading your code a lot easier plus I can copy (highlight/copy) and paste it into my editor without having to correct. So you are doing everybody a favor by using the "Indent Selection as Code Block" button!! Ralph |
October 14, 2011 by nerdgirl |
Ralph, on my makefile it is line 6 that you are speaking of. Let me learn how to get the line numbers in there and you will see, line 6 (all:) is where I typed in realtimeclock1. I've gone onto the next project which is "led_blink" and that works just fine. So I'm happy with that. I will post again soon. Thanks again for your help. |
Please log in to post a reply.
Did you know that you can build an analog amplifier with one transistor and a few resistors? Learn more...
|