Offline
Newbie
Karma: 0
Posts: 4
|
 |
« on: February 20, 2013, 08:45:20 am » |
I have a project where the arduino will collect data while not connected to the PC. Once connected to the PC it sends info out the serial port. It seems that if I don't have the usb connected to the PC that the program will not run. If I leave the pc connected then all functions fine. What am I missing?
|
|
|
|
« Last Edit: February 20, 2013, 09:02:13 am by asinc »
|
Logged
|
|
|
|
|
Johannesburg UTC+2
Offline
Edison Member
Karma: 34
Posts: 1705
|
 |
« Reply #1 on: February 20, 2013, 08:47:18 am » |
Presumably you have the Arduino connected to another power source?
|
|
|
|
|
Logged
|
IT Crowd: Roy... "Have you tried turning it off and on again?" Moss.. "Have you tried forcing an unexpected reboot?"
|
|
|
|
Queens, New York
Online
Edison Member
Karma: 28
Posts: 1552
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #2 on: February 20, 2013, 08:47:31 am » |
Some code would be nice.
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino
Arduino Tutorials, coming soon.
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 4
|
 |
« Reply #3 on: February 20, 2013, 08:48:33 am » |
Yes an external supply is connected.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 4
|
 |
« Reply #4 on: February 20, 2013, 09:03:37 am » |
Actually I just confirmed that the program does continue to run. The problem appears to be that once the USB is plugged into the PC, that the arduino reboots and starts execution again.
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Online
Edison Member
Karma: 28
Posts: 1552
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #5 on: February 20, 2013, 09:05:31 am » |
Actually I just confirmed that the program does continue to run. The problem appears to be that once the USB is plugged into the PC, that the arduino reboots and starts execution again.
Yes, that is what it supposed to do, unless you disable the reset feature.
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino
Arduino Tutorials, coming soon.
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Poole, Dorset, UK
Offline
God Member
Karma: 8
Posts: 669
|
 |
« Reply #6 on: February 20, 2013, 09:06:21 am » |
Two things,
1. when you open the serial monitor it will reset the Arduino.
2. As I understand it serial will hang when its buffer is full.
Mark
Written as you where posting
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 4
|
 |
« Reply #7 on: February 20, 2013, 09:10:37 am » |
Yes, that is what it supposed to do, unless you disable the reset feature.
and how do I do that? So many quick responses! Thanks
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15314
Measurement changes behavior
|
 |
« Reply #8 on: February 20, 2013, 09:13:04 am » |
Two things,
1. when you open the serial monitor it will reset the Arduino. Yes, Irregardless if your using serial statements in your sketch or not.
2. As I understand it serial will hang when its buffer is full.
No, the serial buffers, if overfilled, will just wrap around thus loosing characters but it will still continue to receive and send characters. Lefty
Mark
Written as you where posting
|
|
|
|
|
Logged
|
|
|
|
|
Poole, Dorset, UK
Offline
God Member
Karma: 8
Posts: 669
|
 |
« Reply #9 on: February 20, 2013, 09:38:49 am » |
No, the serial buffers, if overfilled, will just wrap around thus loosing characters but it will still continue to receive and send characters. Lefty Not according to the hardwareSerial code size_t HardwareSerial::write(uint8_t c) { int i = (_tx_buffer->head + 1) % SERIAL_BUFFER_SIZE; // If the output buffer is full, there's nothing for it other than to // wait for the interrupt handler to empty it a bit // ???: return 0 here instead? while (i == _tx_buffer->tail) ; _tx_buffer->buffer[_tx_buffer->head] = c; _tx_buffer->head = i; sbi(*_ucsrb, _udrie); // clear the TXC bit -- "can be cleared by writing a one to its bit location" transmitting = true; sbi(*_ucsra, TXC0); return 1; }
Mark
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15314
Measurement changes behavior
|
 |
« Reply #10 on: February 20, 2013, 09:52:50 am » |
No, the serial buffers, if overfilled, will just wrap around thus loosing characters but it will still continue to receive and send characters. Lefty Not according to the hardwareSerial code size_t HardwareSerial::write(uint8_t c) { int i = (_tx_buffer->head + 1) % SERIAL_BUFFER_SIZE; // If the output buffer is full, there's nothing for it other than to // wait for the interrupt handler to empty it a bit // ???: return 0 here instead? while (i == _tx_buffer->tail) ; _tx_buffer->buffer[_tx_buffer->head] = c; _tx_buffer->head = i; sbi(*_ucsrb, _udrie); // clear the TXC bit -- "can be cleared by writing a one to its bit location" transmitting = true; sbi(*_ucsra, TXC0); return 1; }
Mark I was speaking in reference to the receive buffers which the user has no control over if they continue to receive characters from an external source but are not read out of the 'growing' buffer by the sketch in due time. The transmit buffer, if filled, just becomes a 'blocking' command and will empty the buffer in due time based on the baud rate being used, so nothing is lost on the transmit side, it just 'stalls' your sketch until it's not full. Lefty
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Online
Edison Member
Karma: 28
Posts: 1552
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #11 on: February 20, 2013, 10:01:59 am » |
I believe its a 10k resistor from reset to ground
Reset => 10K => GND
I think, but maybe Lefty knows for sure.
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino
Arduino Tutorials, coming soon.
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
|