Upload button downloads the program to memory

Hello All,

I was trying to retrieve some code that is running on an official arduino uno, After connecting, to the arduino and the IDE finding the comport for the board I hit upload, and to my surprise, it didnt upload to my PC at all. It downloaded the sketch that I had open in the IDE to the board. Now I am worried that the program in the board that I was trying to upload and compare is gone.

is there something that I need to do to make the upload actually upload instead of download? do I need to have the sketch open that I think is on the board? How does one do a comparison of the running program to a PC file? Why does the UPLOAD actually DOWNLOAD?

There is no "user data" store for these programs so I assumed that the commented code would be uploaded along with the uncommented, or is that stripped out like in RS Logix 500? This is very confusing as I cant find anything about uploading a program.

The Upload is from the PC to the Arduino.

There is no Download (from Arduino to PC) button in the IDE.
It is possible using avdrude commands (I've never done it myself).

If you uploaded a new sketch, then yes indeed the prior one is gone.

The "user data" store is your sketch that you saved prior to uploading.
You can also look in the /build directory where the interim files are saved during a compile and upload.
Select File:Preferences, enable Verbose outputs, and you can scroll thru messages to find the .hex that is uploaded to the Arduino and the other files that are created in the process.

What you would have uploaded would have been the Arduino machine code, that is, your program after it has been processed by the Arduino IDE, the gcc compiler, and the linker, not to mention the format conversions that occur prior to the "upload".

The source code (text) is long gone. So is commented code. They never made it into the Arduino.

It may be possible to use avrdude to compare saved machine code with the contents of flash memory on the Arduino. I have never tried. I suspect that this is not what you are after because you wrote about commented code.

OK, I guess its just confusing coming from controllers from Allen Bradley, Siemens, Schneider, Omron, GE, Fanuc, telespace, direct logic.... you get the point. Upload is always PLC memory to the PC. Download is PC to PLC memory. This is why in alot of the programs (like telespace) the Upload button is right on the toolbar but the download is hidden in the menu. There is no chance of screwing something up when you are only uploading to the PC and creating a copy of the running program.

I figured the upload was just that Upload the running program to the PC. I am going to have figure out how to recreate the file that I lost. It seems backwards to me. but maybe its just me. I will just have to save all my files

You didn't save the sketch that you wrote originally? I think the IDE may even save it automatically, or perhaps prompts you, in the later versions?

No I got the board from a friend his program was on it. He moved everything for his aquaponics over to a cheap direct logic DL06 PLC. He does not have the file any longer. Ill just have to write one.

psychocoonass:
OK, I guess its just confusing coming from controllers from Allen Bradley, Siemens, Schneider, Omron, GE, Fanuc, telespace, direct logic.... you get the point. Upload is always PLC memory to the PC. Download is PC to PLC memory.

That seems to me to be the opposite of the normal PC terminology that I have used for as long as I can remember.

For example when I find a file on a website I download it to my PC.

Maybe PLC folks live in ivory towers with everything beneath them :slight_smile:

...R