ComWrt randomly send twice the same string

Dear all,
I have recently ported to a Windows 7 machine an old program which communicates with an Arduino board through (virtual) serial port; the problem is that sometimes (once every about 10 times) the ComWrt function sends the same command to the Arduino board twice; I repeat: in debug mode I "step over" to a call to ComWrt once and I see on the serial line that the string is sent twice! I tried many combination of computers/cvi versions and it seems that the culprit is Windows 7, in fact the exact same program running in two different old xp machines does not show this behaviour and ComWrt seems to run smoothly. Any ideas?
Thanks and best regards!
Nicola

Hi all, now I can update about my problem and its unexpected solution; in the same time I will answer to the last question.
In order to simplify the problem, and following the first suggestion, I put the Arduino board in loopback configuration (no program running in the board, hardware shortcut of RX-TX pin on the borad) and I run the following code:
int main (int argc, char *argv[])
char buffer[30];
int i;
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
OpenComConfig(3,"",9600,0,8,1,0,0);
for (i=0; i<1000; i++)
DebugPrintf("Run no. %i\n", i);
ComWrt(3, "\r", 1);
ComRdTerm(3, buffer, 20, '\r');
Delay(.1);
if (GetInQLen(3)>0)
DebugPrintf("Fail!\n");
return 1;
return 0;
I connected the Arduino board by means of its USB port (which is seen by the computer as a virtual serial port), and it fails. I took also a USB-serial adapter, with pin 2-3 shotcut, and in this case the program runs smoothly: so I can state that it is a problem in Arduino serial port driver (note: I have tried both the last driver 1.6.0 and an old one 1.0.0, but nothing). I tried than to do the same thing with LabView but I used instead the VISA system (because I think it is the only way to use serial port in LW, I'm not expert) and it works! So I can also state that the problem is in the way that ComWrt interacts with the arduino driver in Win7. Than I have also tried using VISA system in LabWindows with the following code:
int main (int argc, char *argv[])
ViStatus status;
ViSession defaultRM, instr;
ViUInt32 retCount;
ViChar buffer[MAX_CNT];
int i;
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
status = viOpenDefaultRM(&defaultRM);
status = viOpen(defaultRM, "COM3", VI_NULL, VI_NULL, &instr);
for (i=0; i<10000; i++) {
DebugPrintf("Run no %i\n", i);
status = viWrite(instr, "Test\n", 5, &retCount);
Delay(0.100);
status = viRead(instr, buffer, MAX_CNT, &retCount);
if (retCount>5) {
DebugPrintf("Fail!\n");
break;
status = viClose(instr);
status = viClose(defaultRM);
return 0;
And, surprise!, it works also with the arduino board. So I understand that VISA and ComWrt use the serial port in a very different way!
To conclude, the initial problem remains unsolved and it seems that the combination LabWindows(ComWrt)+Win7+Arduino is bad; good solutions are: (1) XP instead of 7, (2) USB-serial adapter instead of direct USB connection with Arduino, (3) VISA system instead of direct ComWrt function. The latter seems to me the best alternative.
Best regards,
Nicola

Similar Messages

  • I just got my replacement phone from Warranty. The phone was on for just 2 hours and it crashed. I was told that motorola knows about this "possible" issue. I got a new sim, hard reset, If it can be done I did it. They are now sending me the same phone ag

    I just got my replacement phone from Warranty. The phone was on for just 2 hours and it crashed. I was told that motorola knows about this "possible" issue. I got a new sim, hard reset, If it can be done I did it. They are now sending me the same phone again. Number 3. I would hope this one doesn't crash but I rather have a different phone so I can enjoy using my account. The phone's most recent error was today. " Unfortunately, the process com.motorola.widget.circlewidget3d" has stopped. At least the error message works and it's polite. I told tech this and they could not answer my question or help me other then "let's do a hard reset" My warranty replacement is coming on Monday. Let's hope this one works. Anyone else havinbg the same problem. it says "such and such as stop working" on all sorts of stuff! Help! I want my iPhone Back!

    I just did a google search on this issue. OMG, I got a ton of videos on this or similar issues. Each one says in some way to clear the cache, reset the data, etc. Why in the world would this continue to happen and they not do a fix that resloves this without having to lose or stop what your doing. This is a very long and constant issue it seems with Android phones as there must have been pages and pages of what I now call "Unfortunately"  So I am going to pray that Verizon helps me  out and gets me away from this issue and helps me go back to iPhone or try the Samsung.

  • Change the colour of lines in the same string indicator.

    Hi everybody,
    I'm getting crazy, because I'm looking for the way to change the colour of
    the lines I want in the same string indicator.
    I'm doing an application to control an instrument by serial port, and I'm
    concatenating the lines that this instrument gives me, but there is some
    line that I would want to change its colour, because there has been an alarm,
    for instance. And I only can change all the string.
    Is there any way to do this? I don't know.
    Could you please help me?

    Thank You Very Much.
    The fourth step is a little bit difficult to understand, but what I've done
    is all the three first steps, and in the fourth one I've made an array (I32)
    of the lines that I don't want to highlight and connect it to Disabled �tems.
    Do you think this is a good solution?
    Thank you again for your help. I really needed someone to help me, because
    if not I would still be with the STRING INDICATOR.
    Timothy John Streeter wrote:
    >Hi Carlos>>I'm sorry for being too brief with the last email.>>1) Place
    an 'Multiple Selection Listbox' on your front panel.>>2) Create an attribute
    node. Make the attribute 'Item Names'.>>3) Put every completed line into
    the last element of an array, and then pass the array
    >to the attibute node. (This build the list>of strings in the Listbox).>>4)
    To highlight a line, make an array containing the line numbers (I32) that
    you want
    >highlighted and pass it the terminal of the>Listbox.>>Hope this is more
    helpful>>Tim>>Carlos Jorge wrote>> Thank you for your help, but I don't
    understand what you have told me. What>> I have to pass to the indicator
    node, and what is this indicator node? My>> problem now is the last thing
    I have to do.>>>> Could you please explain my doubt with more detail?>>>>
    Thank you a lot.>> Timothy John Streeter wrote>
    >Hi Carlos>>Try using a 'Multiple Selection List Box' indicator instead of>>
    a string indicator. You>> >can highlight a line by adding the line>number
    to an array and pass it to>> the indicator node.>>Tim>>Carlos Jorge Granadino
    wrote>> Hi everybody,>>>>>> I'm getting crazy, because I'm looking for
    the way to change the colour of>>>> the lines I want in the same string indicator.>>
    I'm doing an application>> to control an instrument by serial port, and I'm>>
    concatenating the lines>> that this instrument gives me, but there is some>>
    line that I would want>> to change its colour, because there has been an
    alarm,>> for instance. And>> I only can change all the string.>> Is there
    any way to do this? I don't>> know.>>>> Could you please help me?>>

  • HT1386 I can't synchronise phone 5s with mac book pro. mac message me : the i phone could not be synchronised because this computer is no longer authorised for purchased items that are on this i phone. then go and authorised mac but keep send me the same

    I can't synchronise phone 5s with i tunes . mac message me : the i phone could not be synchronised because this computer is no longer authorised for purchased items that are on this i phone. then go and authorised mac but keep send me the same message.

    Hi john,
    Follow the troubleshooting steps in this article:
    http://support.apple.com/kb/ts1389
    Cheers,
    GB

  • Multiple Address Book Entries that all send to the same GW account ?

    Our CIO wants a few address book entries that if chosen, will all send to
    the same account.
    Seems easy enough but I haven't found a way, without creating a new account
    that has some Forward or Delegate rule.
    Is there a nicer way to do it without having another real GW account created
    and using Rules?
    I was kind of hoping to just create an External User that simply points to
    the one account but it complains that that e-mail address already exists.
    Thanks
    Marc

    Marc Charbonneau wrote:
    > Our CIO wants a few address book entries that if chosen, will all
    > send to the same account.
    >
    > Seems easy enough but I haven't found a way, without creating a new
    > account that has some Forward or Delegate rule.
    >
    > Is there a nicer way to do it without having another real GW account
    > created and using Rules?
    >
    > I was kind of hoping to just create an External User that simply
    > points to the one account but it complains that that e-mail address
    > already exists.
    Why not using nick names ? The only downside is gw7 and earlier
    nicknames don't show up in the address book. GW8 does show the
    nicknames in the address book.
    Cheers,
    Edward

  • My macpro keeps sending me the same email...a .emix format, and stores in a folder called recoverable mail...slowly fills up hard drive???

    My macpro "mail" keeps sending me the same 387Mb email...about every 2 to 3 minutes...slowly filling up my hard drive...storing the data in a file from my username/library/mail/recoverable mail....
    Very odd.  Don't know if it is malware...or something I have done by attempting to send a .mov that was too big to send via the server?
    I also cannot receive any new mail.  It is not AOL, because from my desktop Mac there is no issue.  It is my MacPro only.
    Andy

    Also, I keep trying to find a way to e-mail Apple about addressing this issue and about the information I am now finding on MacBook HD failures, but I keep getting led in circles in the support section of the website. Anyone know which email I'd use to contact them about this?

  • Failure sending mail: the specified string is not in the form required for an e-mail address.mail will not be resent. Email Notification Component Properties works fine.

    I know there are a few other questions like this but I can't seem to find how it's relating to my issue.  I am getting the familar failure sending mail: the specified string is not in the form required for an e-mail address.mail will not be resent.
    in the reports feature of sccm. 
    I just picked a sample report Compliance 4.  I right clicked hit create subscription and input my email into the TO: field.  When it runs i get the above error.  I checked the email notifcation under configure site components and was able
    to successfully send a test message from there but I dont get why it doesnt work on the subscription.  
    Any Ideas?

    The log is pretty big so im not sure where I can upload it.  I think it would be too big to paste here but I have copied what I think you are looking for in the log and will paste it here.  Let me know some place I can send you the full log file
    or if you want a different log.
    schedule!WindowsService_37!a04!12/07/2014-00:02:03:: i INFO: Handling Event TimedSubscription with data 2946db38-5a07-4fb1-ad06-d7714e25b1ba.
    library!WindowsService_37!a04!12/07/2014-00:02:03:: i INFO: Schedule 534ad96b-a680-4630-a865-9f99e1087e3f executed at 12/07/2014 00:02:03.
    schedule!WindowsService_37!a04!12/07/2014-00:02:03:: i INFO: Creating Time based subscription notification for subscription: 2946db38-5a07-4fb1-ad06-d7714e25b1ba
    library!WindowsService_37!a04!12/07/2014-00:02:03:: i INFO: Schedule 534ad96b-a680-4630-a865-9f99e1087e3f execution completed at 12/07/2014 00:02:03.
    library!WindowsService_37!a04!12/07/2014-00:02:06:: i INFO: Initializing EnableExecutionLogging to 'True'  as specified in Server system properties.
    notification!WindowsService_37!a04!12/07/2014-00:02:06:: i INFO: Handling subscription 2946db38-5a07-4fb1-ad06-d7714e25b1ba to report Compliance 4 - Updates by vendor month year, owner: LEGISLATURE\mrykhoe, delivery extension: Report Server Email.
    emailextension!WindowsService_37!a04!12/07/2014-00:02:06:: e ERROR: Error sending email. Exception: System.FormatException: The specified string is not in the form required for an e-mail address.
       at System.Net.Mime.MailBnfHelper.ReadMailAddress(String data, Int32& offset, String& displayName)
       at System.Net.Mail.MailAddress.ParseValue(String address)
       at System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding)
       at Microsoft.ReportingServices.EmailDeliveryProvider.EmailProvider.CreateMessage(Notification notification)
       at Microsoft.ReportingServices.EmailDeliveryProvider.EmailProvider.Deliver(Notification notification)
    notification!WindowsService_37!a04!12/07/2014-00:02:06:: i INFO: Notification f06f40a4-32f3-4fa6-8077-89083cc7a2a2 completed.  Success: True, Status: Failure sending mail: The specified string is not in the form required for an e-mail address.Mail will
    not be resent., DeliveryExtension: Report Server Email, Report: Compliance 4 - Updates by vendor month year, Attempt 0

  • When I buy in itunes they charge me twice the same thing, when I buy in itunes they charge me twice the same thing

    When I buy something in itunes they charge me twice the same thing and it download twice

    When you sort the Album in iphoto are you sorting manually? Or by date of the photos?
    When you sort in the Finder how are are you sorting?
    Here's one way to do what you're trying to do:
    Create your Album and sort the pics as you want them. Then Photos Menu: Batch Change -> Set Title to Text "John's Birthday", for instance, and tick the box to append a number to each Photo. Now your photos are titled 'John's Birthday 001, John's Birthday 002 ... etc'
    Then File -> Export and in the Export dialogue set the Filename to "Use Title"
    Sort on Filename in the Finder and you end up with a folder full of images in the same order as the Album in iPhoto.
    Regards
    TD

  • Avoid Math.random() from looping the same number twice?

    I'm trying to play a random gallary image by making it stops at different frame every few seconds, and the actions is completely random.
    The problem is, since there are only 5 different images(5 frames) I'm displaying, there is a high probability that it stays at the same frame, how do I avoid that? Like avoid staying at the same page twice, if not run the function again....?
    setInterval(createItems,throwItems);
    var RandomImg:randomImg =new randomImg();
    RandomImg.y=100;
    RandomImg.x=180;
    RandomImg.gotoAndStop(Math.floor(Math.random()*(1+5-1))+1);//generate random value between 1-5
    addChild(RandomImg);
    Thanks

    How do I keep track of the random value, like what value should I put within the if to compare?
    I try modify it a little, and wrap it within an if(), and use preValue to track down the previous frame, am I doing it right?
    setInterval(createItems,throwItems);
    var preValue:Number;
    function createItems():void
         var RandomImg:randomImg =new randomImg();
         var randomFrame= Math.floor(Math.random()*(1+5-1))+1; //generate random value between 1-5
         RandomImg.y=100;
         RandomImg.x=180;
         RandomImg.gotoAndStop(randomFrame);
         if(preValue == randomFrame)
              RandomImg.gotoAndStop(Math.floor(Math.random()*(1+5-1))+1);
              addChild(RandomImg);
              preValue = randomFrame;
         }else
                        addChild(RandomImg);
                        preValue = randomFrame;

  • String objects with the same string pointing to the same place but?

    Hi,
    Here is a simple sample
    String str1 = "a";
    String str2 = "a";I understand that in Java str1 and str2 pointing to the same place in memory and Java compiler wouldn't save the string "a" in two different places in memory. Am I right?
    If so, if the value of str1 changes to something else as following:
    String str1 = "a";
    String str2 = "a";
    str1 = "b";why str2 which has been pointing to the same place as str1 before is still containing ?a? and not ?b????
    Thanks!

    Maria1990 wrote:
    Hi,
    Here is a simple sample
    String str1 = "a";
    String str2 = "a";I understand that in Java str1 and str2 pointing to the same place in memory and Java compiler wouldn't save the string "a" in two different places in memory. Am I right?Correct.
    Maria1990 wrote:
    If so, if the value of str1 changes to something else as following:
    String str1 = "a";
    String str2 = "a";
    str1 = "b";why str2 which has been pointing to the same place as str1 before is still containing ?a? and not ?b????Because str2 is pointing to the same "a", but it is not pointing to str1.
    This is what happens:
    String str1 = "a";
    /*                 +---+
             str1 ---->| a |
                       +---+
    String str2 = "a";
    /*                 +---+
             str1 --+->| a |
                    |  +---+
                    |
             str2 --+
    NOT:
                       +---+
         +-> str1 ---->| a |
         |             +---+
         |
         +- str2
    str1 = "b";
                       +---+
                 +---->| b |
                 |     +---+
                 |
                 |     +---+
            str1-+  +->| a |
                    |  +---+
                    |
             str2 --+
    */

  • ICal displays twice the same date on the calendar

    Ater upgrading to 10.6 and 10.6.1, iCal messed up previous calendars, duplicating a day in the calendar. Specifically, in my case, "Saturday, 17th October" appears twice, one after the other (in portuguese). This affects all future events, which now are shown one day earlier than they should.
    I've seen this bug in iCal before, some time ago, so perhaps it is not something specific to this version. Anyway, it is hard to believe that such errors can occur... embarrassing.
    The image to the problem is on http://files.me.com/marinho.barcellos/8ux17j
    Marinho.

    I think I got it (at least for me)! The time zone comment from "The Cowboy" got me thinking . . .
    I set my System Preferences, Date & Time to another time zone with the same offset from GMT as where I live, but a place without Daylight Savings (Lima). I then exported a VCAL from Palm Desktop and imported into iCal. It worked!! The single all-day events were not 2-day events no matter when they were on the calendar (DST or not). The single day events at a specific time were all correct for their time of day, again no matter what month they were in.
    Next step, the iPod. I set my Settings, "Mail, Contacts, Calendars," Calendars, Time Zone Support, ON, Time Zone of Lima. Then synced m iPOD with Info, Calendars, Sync iCal set, and voila, everything shows up exactly as I want.
    I think I might have "turned off" the Daylight Savings processing and I don't know what else it might do, but for now, it works. What a way to run a railroad, though.
    I never have liked iCal with its impossible colors and too-small display. This DST thing puts a nail in the coffin for iCal for me.
    Thanks, El Gaucho, for the tip on time zones. Never in a million years would I have tried anything like that.

  • When i try to send a photo with i photo the program sends always the same one, what can i do?

    When i try to send a photo by iphoto share, the programm always sends the same one. Why? What can i do?

    What version of iPhoto?
    For iPhoto '11 IMHO the best solution is to set Mail as your email client in the iPhoto preferences
    LN

  • TS2755 Why do some of the imessages go in green, and some go in blue, when sending to the same phone number? Does it have anything to do with the cellular carrier?

    Can someone please tell me why when you are sending a message to the same phone number, and they also have a I-phone, that some of the messages go in blue and you can see that it has been delivered and read, and some messages go in green and you can't see if they got the messageor if they have read the message?

    SMS messages are shown in green, iMessages in blue. If the recipient is an iPhone user but doesn't have a data (WiFi or cellular) connection and you have Settings>Messages>Send as SMS enabled, that person will get your messages as SMSs until they have a data connection again.
    iMessages have delivered notification (and read notification if the recipient has that feature enabled). SMS does not.
    Best of luck.

  • IMessage sends me the same text i just sent to someone else.

    After upgrading to iOS 6 last night, whenever my wife or I send or receive a text on our phones, the other person gets a duplicate.  In other words, when I send a text to someone, i also get the text in my messages inbox.  Or when someone sends my wife a text, i get the text as well.  Two different phones with two different numbers but we do share an Apple ID.  Any suggestions how to stop this?

    You don't need to get your own Apple IDs.  If you go into System Preferences on each device, make certain that you ONLY have the email listed under FaceTime that you want that device to receive.  You can both have the same Apple ID.  I have had to do this with a number of iPads, iPods and iPhones among my wife and my grandchildren as we share on Apple ID.  You can delete the EXTRA email address by just clicking on them.

  • Outgoing Mac Mail always send from the same address?

    Hey y'all -
    I use 3 gmail accounts through mac mail for 3 different purposes - all fine. But when I send mail, regardless of what account I send it from, recipients always recieve my emails from the same address? E.G. I send an email from addresses 1 or 2, but when they are received they are from address 3? I've also removed address 3 from mac mail, but recipients STILL see address 3 as the sender. Can anyone help? Would a reinstall of mail be appropriate, if so what would be the effective way to go about it?
    Thanks in advance,
    Stu

    SOLVED IT!
    Right, I had multiple email accounts, all gmail, address 1 2 & 3.
    All mail went to the right addresses, fine. But when I compose, lets say from address 1 or 2, it ALWAYS ends up being received the other end by address 3. I only find this out until I get a reply delivered to the wrong address.
    SO  go to preferences, select one of the problematic addresses, then outgoing mailserver (SMTP:) in this case it will say Gmail. Click it so you get the drop down and edit SMTP list. There is a tab that says advanced. This is where I noticed the problem. On my list of SMTP servers I had one for my microsoft account, and then one Gmail one for all 3 gmail accounts. And what did I find for authentication? the username and password of the problem address that ALL my gmail accounts were sending through. You need to create SEPERATE smtp servers for each and every account, especially when using multiple accounts of the same kind (e.g. 3 gmails!)
    This fixed the problem for me perfectly and now my emails send from the CORRECT selected address. HOORAH!
    ALSO...
    Regardless weather it by gmail or hotmail you compose from, mac defaults to using the next working server. Before setting up seperate smtp servers for each gmail I just deleted the one that was there and then it started sending from microsoft account etc... just to clarify that it works regardless of account type!

Maybe you are looking for