esp8266 esp-01 printing garbage values on serial monitor
The "garbage values" are most likely messages from the bootloader, output at 74880bps. Try watching its serial out at that speed. You'll probably see messages that look something like:

ets Jan  8 2013,rst cause:2, boot mode:(3,7)
load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d


The rst cause number will give you an indication of why the chip rebooted.

The most common reset causes are


power on
hardware watchdog timer
fatal exception (most likely error in your code or power issue)
software watchdog timer
software reset
deep sleep
hardware reset


If it's a "fatal exception", you should see another line that looks like this:

Fatal   exception   (28):
epc1=0x4025bfa6,    epc2=0x00000000,    epc3=0x00000000,    excvaddr=0x0000000f,    
depc=0x00000000


Look up the exception number; if it's not obvious what it means, google it to learn about the causes.