Serial.Begin

Is there anywhere I can look at the code for the functions like serial.begin? My question is about what is happening at a low level. For example, I'd like to set up an arduino to send statuses to the serial port, and store it to an sd card. The serial port will not always be plugged in to a device, a laptop will be used to periodically check and or troubleshoot the board. The issue being that serial.begin won't return unless it is plugged in. Any suggestions?

I wish I could answer more technical questions, but I'm quite new myself!

But as far as the learning part goes, always check the Arduino website, amazing information all over.

http://arduino.cc/en/Serial/Begin Also, check the bottom of that link for the other serial functions explained.

http://www.lulu.com/items/volume_63/1108000/1108699/4/print/ARDUINO_NOTEBOOKv6.pdf A great PDF file, I downloaded it and printed it for reference. Lots of the code explained.

Is there anywhere I can look at the code for the functions like serial.begin?

They are in source files under...

(ArduinoBaseDirectory)\hardware\cores\

Serial.begin is in...

(ArduinoBaseDirectory)hardware\cores\arduino\HardwareSerial.h

The issue being that serial.begin won't return unless it is plugged in.

Are you certain? It looks like Serial.begin sets two registers, sets three bits, then returns. If that's the case, Serial.begin will always return.

Good luck, Brian

The board I'm using is a freeduino maxserial board, as I need the serial, not usb interface.

If you take the ASCII table example and modify the loop to read

// if printed last visible character '~' #126 ... if(number == 126) { number=33; }

This should loop through the ascii table indefinitely. What happens is every time you unplug the serial cable, and plug it back in, it always restarts at the ASCII Table ~ Character Map in the setup function.

Does this help...

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1204641836

  • Brian

is your board resetting when you plug it into the laptop?

Ahh yes, the disable auto-reset thread posts deal with this situation exactly. Thank you for pointing me in that direction.