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 » How to reset the MCU to the vanilla "Congratulations!" state please?

April 25, 2010
by Wobbler
Wobbler's Avatar

It has arrived! Really pleased to receive it although the Government and Post office chose to jointly bill me for an extra £18... Grrrrr.....

I have had a play and am now at p. 46, Embedded Programs Part 1. I can't believe how much I have learnt already!

However, I have my son with me this weekend and wanted to restore the MCU to the "Congratulations!" message so we can re-wire it from scratch and he can learn with me. Is there an easy way to do this please? I successfully did the first programming bit so the message has gone... :o(

Many TIA...

April 25, 2010
by mrobbins
(NerdKits Staff)

mrobbins's Avatar

Hi Wobbler,

Glad to hear that your kit arrived and that you're learning a lot!

I've just e-mailed you the "preload.c" file which contains the scrolling text "Congratulations" message that the microcontrollers are preloaded with when shipped.

Also, take a look at this forum thread in which I describe how the scrolling LCD text is achieved in more detail.

Best,

Mike

April 25, 2010
by mcai8sh4
mcai8sh4's Avatar

Hi Wobbler (nice name),

If things haven't changed since I first got my kit, there should be a directory in the code folder called something like initialload, go to that directory and type make - it should upload the initial code that came on the chip.

Good luck, have fun

Steve

April 25, 2010
by mcai8sh4
mcai8sh4's Avatar

hehe, Mike beat me to it :)

April 25, 2010
by Wobbler
Wobbler's Avatar

Mike/Steve,

Many thanks for the v. rapid responses! I've just got the email and will be updating as soon as I finish posting...

Cheers!

April 25, 2010
by Wobbler
Wobbler's Avatar

OK. How do I create a MakeFile please? The attachment is a .c file...

Sorry - this must seem painful to you experts!

April 25, 2010
by BobaMosfet
BobaMosfet's Avatar

Can you use the original make file that came with the kit?

BM

April 25, 2010
by mcai8sh4
mcai8sh4's Avatar

No need to apologise (although I'm not an expert, so your apology doesn't really apply to me!)

The easiest and quickest was is to copy a makefile from another file and just change all names to suit your new program.

Remember NOT to use Notepad - it does strange things.

A simple find and replace should work. After a short time, and a little reading, you will then understand the Makefile a little better.

If you have any other problems/questions, shout out.

April 25, 2010
by mcai8sh4
mcai8sh4's Avatar

and again, beaten to it whilst I was typing!

April 25, 2010
by Wobbler
Wobbler's Avatar

Great! I'm on it now...

Thank you!

April 25, 2010
by Wobbler
Wobbler's Avatar

IT WORKS!!!!

Thanks all - I can go to bed now. :o)

Most impressed with the support here - great stuff!

May 05, 2010
by treymd
treymd's Avatar

I'd like to elaborate on the notepad reference, because a little knowledge goes a long way. The reason notepad can be problematic is because of the way microsoft chose to end a line of text.

they put a carriage return AND a line feed character at the end of the line, whereas most everyone else drops the carriage return.

In C, the escape sequences for this are /r/n for microsoft's way, and simpley /n for linux and many others.

there are 2 simple programs in linux that convert back and forth, dos2unix, and unix2dos, I've used them a ton. Many programmer's text editors will have a menu option to convert the files as well.

I hope this post is of use to some!

May 05, 2010
by mcai8sh4
mcai8sh4's Avatar

treymd : Thanks for that, I'm sure thats gonna be useful to alot of people. I gotta admit, I knew it was something like that, but I wasn't certain enough to post it.

Thanks for clearing that up for me.

As a side note, what are the benefits of notepad using /r/n?

Cheers mate

-Steve

May 05, 2010
by Rick_S
Rick_S's Avatar

I believe these actually originated with manual typewriters. On a manual typewriter, you have two motions to reset the carriage to the beginning of the next line. The first as you would hit the arm would index the carriage up one line and then as you would follow through, the second would push the carriage to the start of that line. Thus the "carriage return" + "line feed". This was a standard early on even before ms-dos PC's. I know the Unix world has been a single CR code for years as well. Which was first, I'm not sure.

May 06, 2010
by treymd
treymd's Avatar

Rick is probably spot on. Remember that the computer replaced the typewriter. Microsoft took things a little too literal and said, "You have to advance a line and push the drum back to the start". The unix world saw no need and said that simply delimiting the line was sufficient.

mcai8sh4 - I have yet to see a benefit for the extra /r, I find myself taking that extra step removing it all the time and that is about it. Perhaps someone can enlighten me but in my opinion it's just there because Bill Gates said so. A personal preference thing.

May 06, 2010
by treymd
treymd's Avatar

Rick, as to the question of which was first: Unix. It was invented by bell labs. It goes like this: C was created which begat a compiler which begat the OS. We here at nerdkits are in the business of using a trimmed down OS, but an OS just the same. Foodloader and our custom code IS the OS.

Bill Gates decided to make his own OS rather than use the one that Bell labs created. Linux is an open source clone of unix, BSD is an actual descendent of unix as far as I know, and solaris IS the unix codebase as purchased from whomever had it last.

But unix was first.

May 06, 2010
by bretm
bretm's Avatar

While it's undeniably true that Unix predates Windows, it's not true that this means that \n predates \r\n, because neither Windows nor Bill Gates invented the \r\n convention, nor did Unix invent the \n convention. Microsoft didn't "take things too literal" and Unix didn't "not see the need."

According to the Newline article on Wikipedia, \r\n was in common use on early computer systems that had adopted teletype machines as a console device.

Unix's convention was inherited from Multics which began development in 1964. Prior standards either supported both (ISO) or only \r\n (ASA, predecessor of ANSI).

Window's convention was inherited from MS-DOS which was inherited from CP/M which was inherited from the teletype standard exemplified by the ASR33 which came out in 1962/1963.

So you could argue that \r\n came first if that article is accurate. But that doesn't make it better.

May 06, 2010
by Rick_S
Rick_S's Avatar

That's what I was trying to say when I spoke of pre-MS-DOS machines having the rn standard.

BTW, treymd, C was far from being the 1st programming language, and UNIX was not the 1st OS. Fortran, LISP, Cobol, and of course Assembly all pre-date C. Even BASIC (according to Wikipedia) pre-dates C by about 6 years. Unix didn't come around until the late 60's nearly 20 years after the first computers had been installed in US government offices (UNIVAC's) of course, the ENIAC even pre-dates those. Also, as bretm stated, those early computers used the rn convention all based on their use of mechanical output devices which had been based on manual typewriters...

I did most my learning on rn computers Several of which were Microsoft OS based, some of which were not.

Again, which is better?? It's a matter of one's preference I guess.

Rick

May 06, 2010
by mcai8sh4
mcai8sh4's Avatar

Cool, thanks for the info guys :)

Everyday's a school day.

May 06, 2010
by Rick_S
Rick_S's Avatar

Sorry to take this thread soooooo off topic :D

\r\n
May 10, 2010
by treymd
treymd's Avatar

LOL Rick!

yeah I know there are languages that predate C, I was just trying real hard not to get people interested in them. In the software engineering world there is a whole bunch of ressurecting languages that just don't matter. We all need to stop inventing languages and stick to one or 4 (explained below) so that code is easier to maintain. It all goes back to binary anyway.

This ruby garbage... and any new language needs to die, we have enough to learn. Computer science, and electrical engineering are the same field, ask MIT.

on the 4 languages, you need a portable one, a fast one, assembly, and a rapid application language, like VB or perl, or gasp ruby... but we don't need 500 of them, they all suit our needs. I want to play with uC's and I feel as if I have to read new languages constantly! Too much to keep up with.

sorry for the rant but software engineers need to learn microcontrollers so they stop inventing programming languages.

May 10, 2010
by treymd
treymd's Avatar

way back in the day there were not languages.. there were punch cards.. and before that... computers were huge and has a bunch of switches on them. gotta feel sorry for those guys!

May 10, 2010
by treymd
treymd's Avatar

mcai >> btw in all this knowledge tossing, all you need to know is that /r/n and /n is just two different ways to do the same thing. We IT people like to compete with each other (which is stupid). Just know there is no benefit one way or the other, it's just the way it's done... it's all protocols (the way it's done) and datasheets (how it works)

June 13, 2010
by TimCole
TimCole's Avatar

Just to add to the mix --- /r and /n originated not from typewriters but teletypes. There are legitimate reasons to separate the "Newline" and "Carriage Return" functions. One thing it allows you do to is overtype a line. This was often done to produce typographical characters that couldn't be produced any other way, particularly with the older pre-ASCII teletypes.

Later on, it provided a standard method of obscuring passwords: print a bunch of "M"s and "X"s (or other letters, but those worked well), wait for the user to type the password, then print over the password.

June 13, 2010
by Rick_S
Rick_S's Avatar

I would have to guess - and this is only a guess, that since mechanical typewriters pre-date teletypes, that their behavior was designed to mimic the mechanical behavior of typewriters that people of that day were familiar with.

Post a Reply

Please log in to post a reply.

Did you know that you can make a huge, multi-panel LED display? Learn more...