NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Support Forum » "C Programming: The printf and scanf Family of Functions" Can't get it to run in console

May 24, 2012
by live4the1
live4the1's Avatar

I have sent the program to the MPU but every time I try to run it in the console the programmers notebook program pops up and nothing is going on in the console window. What am I missing? I'm using Windows 7. The compile process completes via the make file but I am dead in the water after that.

May 24, 2012
by pcbolt
pcbolt's Avatar

@live4the1 -

If your MCU has been programmed with the file downloaded from the tutorial page, all you need to do is to open Hyper Terminal in Windows 7, then turn the MCU on. You should get the program prompts in the Hyper Terminal window.

If you are trying to compile the code listed on the tutorial page, you'd have to copy it to Notepad, save it, then run the "gcc" program which comes with the Cygwin or MinGW download.

May 25, 2012
by live4the1
live4the1's Avatar

Ok, thanks pcbolt! I had to install putty. I made the mistake in thinking that I could run the .C program from the CMD console just like you run the make file. I am guessing that with Cygwin you can create and executable that would run in the CMD console? I did install Cygwin but have not figured out how to use it yet. I was able to see the program run using putty.

May 25, 2012
by pcbolt
pcbolt's Avatar

Cool -

I haven't used Cygwin, but I was able to compile the console program using the MinGW programs. I copied the listing off the tutorial page, pasted it into Notepad, saved it as "test1.c" in the same directory as the "gcc" program ("bin" directory) and tweaked the command line shown on the tutorial page and it ran.

May 25, 2012
by Ralphxyz
Ralphxyz's Avatar

ie:

pasted it into Notepad

pcbolt, I really hope you mean Programmers NotePad not Windows NotePad?

Ralph

May 26, 2012
by pcbolt
pcbolt's Avatar

Ralph -

Why not Windows Notepad? I know it can cause problems with Makefiles (tabs and such), but it's good to know how to take any text editor, enter a few lines of code, compile with "gcc" and Voila!...a working program.

P.S. - You're really going to hate me for admitting I do most of my AVR editing (but not compiling) in Microsoft Visual C++ environment :-)

May 27, 2012
by Ralphxyz
Ralphxyz's Avatar

Why not Windows Notepad?

Windows Notepad does a Windoze EOL (End of Line) not a Unix EOL.

The compiler and Make is looking for a Unix EOL.

You can use any "text" editor for editing code I use NotePad++ primarily because it does "Vertical Editing" and it is free.

Of course I have used Visual Studio and Vi and I got very attached to Emacs back when Linux came on 36 floppies.

Ralph

May 27, 2012
by Rick_S
Rick_S's Avatar

I just Windows Notepad'ed up the initialload.c file placing a CR/LF at the end of each line and it compiled fine. Even though it would be a very crude code editor, I think it will work. I even changed a makefile over with CR/LF pairs and it worked fine as well. I don't thing it matters quite honestly as long as the files are kept in a Windows environment. Now if you were to try to move them to a Linux/Unix or Mac environment there may be complaints there. I haven't tried that.

Rick

May 29, 2012
by pcbolt
pcbolt's Avatar

Ralph -

I haven't gotten my Linux system going yet, still on Windows. Everything works OK without any fiddling with the EOL sequence (within Windows alone).

Thanks for the link to NP++...I can't say how many times I could have used the vertical highlighting/editing.

May 30, 2012
by Ralphxyz
Ralphxyz's Avatar

Vertical editing is essential for programming especially when you want to comment out 10 lines or more of code, with vertical editing it is a two or three step process at most instead of have to step to each line to enter the comment delimiters

//

//

//

//

//

//

//

//

//

//.

Ralph

May 30, 2012
by pcbolt
pcbolt's Avatar

Ralph -

I also saw that NP++ also has an auto comment feature to do this in 1 step. I've always used --

/* - start of comment block
   - more lines here
//*/ <- end comment block

Then you can just add a '/' before the start comment block to "un-comment"

May 31, 2012
by Ralphxyz
Ralphxyz's Avatar

I use your method often especially for bigger sections of code, > 10 lines.

I hadn't seen NotePad++'s auto comment I'll have to play with it.

Ralph

Post a Reply

Please log in to post a reply.

Did you know that electric fields behave differently in different materials? Learn more...