Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Adruino Resetting with incomming serial data

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-ARDUINO
View previous topic :: View next topic  
Author Message
snow

Bascom Member



Joined: 28 Jun 2005
Posts: 145
Location: Ashburton / Mid Canterbury / New Zealand

newzealand.gif
PostPosted: Fri Jul 31, 2015 11:40 am    Post subject: Adruino Resetting with incomming serial data Reply with quote

Hi all
I've got a Arduino mega project hooked up to a PC for sensor data logging. The comms is USB to the micro USB port on the arduino. I have got MS Access to send an sensor ID via the usb comms. The Arduino reads this ID and reads the sensor and transmits the data back. Works well

I have noticed something weird. When the ID request is transmitted to the Arduino for the first time only ,the Arduino resets. Then it runs up fully. This is not a big issue I'm just wondering why and should it.

Here is the code snippet that reads the comms

Code:

   Serial_flag = Ischarwaiting()                                                'Listen to the Uart rs232 port for data to turn up

   If Serial_flag = 1 Then                                                      'We got something in the Uart
      Rx_data = 0
      Rx_data = Waitkey()                                                       'Get it

      Filter_command                                                              'Call the sub that fiilters the ID and reads the sensor

      Locate 1 , 1
      Lcd Space(16)
      Locate 1 , 1
      Lcd Rx_data ; ": " ; Sensor_value                                    ' Display it on the LCD before it is sent out. Used for data checking


      Print Sensor_value                                                        'Send the data back to access
      Tx_data = 0
   End If
 




The whole project works well but just trips up for a few cycles at the start

Thoughts??
Cheers Snow
Back to top
View user's profile
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 840
Location: France

france.gif
PostPosted: Fri Jul 31, 2015 3:05 pm    Post subject: Reply with quote

no idea . But it does the same when I use the terminal emulator from the IDE : It does a reset when it is called

Rolling Eyes
jp
Back to top
View user's profile Visit poster's website
enniom

Bascom Member



Joined: 20 Oct 2009
Posts: 462

https://www.mcselec.com/c
PostPosted: Sat Aug 01, 2015 12:03 am    Post subject: Reply with quote

Is it possible that the PC toggles the DTR / RTS lines and one of them Resets Arduino?

Ennio
Back to top
View user's profile
tronicgr

Bascom Member



Joined: 22 Apr 2009
Posts: 17
Location: USA, San Diego

usa.gif
PostPosted: Mon Aug 03, 2015 2:29 pm    Post subject: Reply with quote

I had to cut the reset line that was connected on the ftdi chip. Works fine now and if I need to program it again, I manually press the reset button on the arduino as soon I click to program it.


Thanos

_________________
Visit my blog about 6DOF controller electronics
http://motionsim.blogspot.com/
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Mon Aug 03, 2015 5:16 pm    Post subject: check weatherstation program in the BLOG section Reply with quote

Have just published a weatherstation in the BLOG section of this forum. It also makes use of a Arduino and gets serial info from an other device.

Perhaps you can check the code how we did it. We also have spend some time to get the right solution...

Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-ARDUINO All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum