I have an Arduino micro board with a code in it.
I didn't make the code with my pc so I don't have a backup of it.
how can i back up the existing code before I'm writing a new code on my board?
You should be able to use extract the compiled binary from a board, bit that looks nothing like the source.
I hope you didn't want the source.
You need an ISP programmer and the ISP pins on your board. You can make any Arduino into an ISP programmer by programming it with the ISP example sketch.
Then you can use AVRDUDE commands to interrogate the target board. The examples below were written for a programmer board attached to COM3.
avrdude -p m328p -P com3 -c avrisp -b 19200
avrdude -p m328p -P com3 -c avrisp -b 19200 -U flash:r:"GLB_flash.bin":r -U eeprom:r:"GLB_eeprom.bin":r
It’s ages since I did this. My notes don’t show the upload command, but it should not be too difficult to work it out.