Go Down

Topic: Arduino micro usb coms (Read 124 times) previous topic - next topic

I have. A working project running on a Uno. I want to transfer to a Micro.
Loaded my Arduino program up to the Micro.
Communications work fine using the monitor, can send and receive to and from the Micro.
Using my program ( only a port number change) I can send to the micro but the Micro won't send returned data.
Any suggestions please.

Robin

Robin2

Using my program ( only a port number change) I can send to the micro but the Micro won't send returned data.
Any suggestions please.
Yes - provide a lot more information.

What is "my program"?
Is it on the Arduino or on your PC?
Post the Arduino code.

...R

My program is a control program. The PC can send and receive data via the UNO to an  AD7793 ADC and also store characteristics in the EEPROM. Has been working well for some time.
I now want to reduce the size to a Micro.
I can store data in the EEPROM from the PC and retrieve data to the PC using Micro and the monitor.
But I can only store data in the EEPROM using my working program.

Robin2

My program is a control program. The PC can send and receive data via the UNO to an  AD7793 ADC and also store characteristics in the EEPROM. Has been working well for some time.
I now want to reduce the size to a Micro.
I can store data in the EEPROM from the PC and retrieve data to the PC using Micro and the monitor.
But I can only store data in the EEPROM using my working program.
So, what is the answer to my other two questions?

...R

There are two parts to the program
A. On the Arduino......sorts and executes commands from the PC.    Eg. WMEM 1,hello:       writes "hello" to the Arduino first 20 bytes of EEPROM.      RMEM 1;    Reads the Arduino first 20 bytes of EEPROM and returns "hello" to the PC.
B. on the PC is the main control program, gets data and coefficients from the Arduino, carries out all calculations and displays results.


The Arduino program is written (badly but works) in C,  the PC program is written in Visual Basic Application. (VBA).

The company will not post the 12k Arduino program nor the PC program on a forum.

I only need to know the difference in operation between the UNO and the Micro

Regards
Robin

Robin2

The company will not post the 12k Arduino program nor the PC program on a forum.
In that case they should stop being a cheapskate and pay a professional for advice

Quote
I only need to know the difference in operation between the UNO and the Micro
I suspect the problem lies in the code.
Your question is a bit like asking what is the difference between a Volkswagen and a Ford.

...R

Small company, small budget.
I will try to post a cut down version, just the relevant parts.

Attached,
Comms Tester.application for the PC
Comms_Tester_Arduino.ino    for both the Uno and the Micro
If you want to try these
After loading the Arduino files.
Open the PC application.    Select the COM port.   Key in WMEM 1,xxxxx:      then RMEM 1:
This should return the memory data.

Robin2

#8
Jan 18, 2015, 11:39 am Last Edit: Jan 18, 2015, 11:39 am by Robin2
You did not include any PC code.

Some comments on your Arduino code ....

Strings (big S) can cause problems in the small memory of an Arduino. Use strings (small s)

The code examples in serial input basics are neater and more reliable ways to receive data and they don't need delay()s or block the rest of the Arduino.

If all you want is the choice between reading or writing why not make things simple by using a single character R or W rather than 4 chars WMEM ? The last 3 characters are completely useless.

...R

#9
Jan 19, 2015, 11:47 am Last Edit: Jan 19, 2015, 11:50 am by RWDesignCyprus
Please find the word doc with the cut down comms program for the PC, I tried to send it in application form with no success.
The WMEM and RMEM are only two of about 50 commands all of which use 4 digits.
if I can read from memory all the other read commands will work

Regards
Robin

Robin2

#10
Jan 19, 2015, 07:11 pm Last Edit: Jan 19, 2015, 07:13 pm by Robin2
Much easier if you post code as  a .txt file rather than a Word document.

I'm not an expert on Visual Basic so I am not able to offer specific comments on your code.
I don't see any code to check that the Arduino has completed its reset process when the serial port opens. The Python code in this demo should illustrate the idea. It may be a good learning idea for you to write a PC program that interacts with my Arduino code in place of my Python program.

I also don't see anything in your code which closes the serial port. That may be a good thing because the serial port should not be closed until you are completely finished with the Arduino. But I worry that there CLOSE might be happening somewhere offstage.

...R

Many thanks for your help, unfortunately I have run out of time.
I hope to re-visit the problem when I can find a time slot. Meanwhile we can still use the Uno's.

Regards
Robin

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy