PLX-DAQ version 2 - now with 64 bit support! (and further new features)

iterlandes:
Why not interface with openoffice calc or libreoffice calc? That way, everything would be Open Sourse !!!

Thanks for the beautiful work and spirit of solidarity !!!

Hi iterlandes,

well PLX DAQ is already open source :slight_smile: But it relies on VBA by Microsoft thus porting it to openoffice might be tricky. Although I admit I am not having any experiences with that. Same goes for libreoffice.

In case you feel capable please give it a try and revert back how it went.

Greetings

NetDevil:
#Jonathan

I took giant steps, but now I need your help, I put the sketch on you, my sketch detects me data every 10 seconds and writes the data on excel
10
20
30
etc.
I would like but I don't know how to have this data converted into hours, minutes, seconds, you can help me, thanks

long t=0;
int PinBatt = A0;  
int ValPinBatt;
float Vpin_perc;
float Vbatt;  
float calc_res;
float R1 = 10000; //modificare questi valori con i valori realmente utilizzati.
float R2 = 10000;


void setup() {
  Serial.begin(9600);
  Serial.println("CLEARDATA");
  Serial.println("LABEL,Time,Timer,t,Vbatt");
  pinMode (PinBatt, INPUT);
  calc_res = (R1 + R2) / R2;
}

void loop(){ 
  
  Serial.print("DATA,TIME,TIMER,");
  Serial.print(t);
  Serial.print(",");

  Serial.print("");

  ValPinBatt = analogRead(PinBatt);
  Vpin_perc = map (ValPinBatt, 0, 1023, 0, 500);
  Vbatt = Vpin_perc * calc_res / 100;
  Serial.println(Vbatt); 
  t=t+10;
  delay(9900);
  
}

lidas:
I would like but I don't know how to have this data converted into hours, minutes, seconds, you can help me, thanks

Hi lidas and congrats on the improvement and steps forward :slight_smile:

So I take you would like to have the hour / minute / second in three different columns in Excel? In that case you are right, there is no function in PLX DAQ. But it is pretty easy to implement for yourself in case you might want to take a small glimpse in VBA.
Just open the macro editor and go to the code level of the form. You will find a switch statement for all the different commands (e.g. "LABEL" or "DATA" or "SAVEWORKBOOKAS" and even "TIME). Just copy & paste the "TIME" command three times, name it as "JUSTHOUR" / "JUSTMINUTE" / "JUSTSECONDS" and implement the commands explained here: Home - Algorithms

Dim strTime

strTime = Time    

MsgBox "Current Hour is -> " & Hour(strTime)
MsgBox "Current Minutes of the Hour is -> " & Minute(strTime)
MsgBox "Current Seconds of the Minute are -> " & Second(strTime)

Hi NetDevil Many Thanks for the help
but I don't understand what I have to do I have attached my excel sheet, you can edit it yourself, I'm interested in the "t" column of the "3S Battery and 2s Battery" worksheet, you become hours, minutes, seconds, you do this to me please, thank you

dati curva di scarica batteria.xlsm.zip (268 KB)

Hi lidas

sorry but as written above my priorities have recently canged majorly. Therefore I won't bei able to activrly change your code.

Please try to take a look yourself (since we are all programmers anyways) or try to find someone here in the board who can help you.

Anyways I will put the change ideas on the backlog for any future version.

Hi NetDevil
I'm not a programmer and I don't know where to get my hands, you surely took five minutes to do it, that's why I asked you

Hi,

I'm a beginner with Arduino program, and I can't find a way to extract the last 6 characters of the "cmd", to send it to Excel.

The data received comes from an RFID reader connected in RS232/Uart on terminals 2 and 3.

Currently, the program sends the complete chain "ccffff1032d1e2001949f214202046ce29" in Excel through PLX-DAQ.

Can you help me by modifying my little sketch, so that it only sends the last 6 characters "46ce29"?

Thanks in advance.

  #include <SoftwareSerial.h>

   SoftwareSerial mySerial(2, 3); // RX, TX / Broche entrée Scanner

  //String buffer/mémoire tampon
  String cmd = String("");
  char a = 0;
  
  void setup() {
  // Initialise les communications série et baudrate à 9600
  Serial.begin(9600);     //entrée série Standard
  mySerial.begin(9600);   //entrée Scanner sur 2(RX) et 3(TX)

  Serial.println("CLEARSHEET"); // clears sheet starting at row 1
  Serial.println("CLEARDATA");
  Serial.println("LABEL,Date,Time,Equipe");
  
  // Affiche un message quand le port série est ouvert.
  // Permet de vérifier que le programme est bien en court de fonctionnement
  //DD Serial.println("Serial communication is ready.");
  }

  void loop() 
  {

    // Vérifier si des caractères sont reçu sur le port série
    if (mySerial.available() > 0) {
      
      // Variable temporaire pour copier le caractère lu
       byte SerialInByte;
       // Lire un caractère (un Byte)
       SerialInByte = mySerial.read();
           

          // ajouter le caractère à la mémoire tampon (cmd)
          cmd += String(SerialInByte, HEX);
          
          a = a + 1 ;
                    if (a == 20) {
                    
     Serial.print("DATA,DATE,TIME,"); Serial.println( cmd );
     //DD Serial.println( cmd ); 
     
     cmd = String(""); 
     a = 0; 
     SerialInByte = 0;
     
    }     
          
 
   }
  }

That worrk !!!,

With this solution :

Serial.println(cmd.substring(cmd.length()-6,cmd.length()));

Regards

Hi ddominique,

thanks for sticking to it and congratz on finding the solution on your own :smiley: :wink: well done :slight_smile:

I do use string a lot but I do get criticized for using it a lot as well. Honestly that criticism is justified. String type uses a hell lot of RAM space to be declared alone in the first place. in case you are about to write any larger sketch please consider switching to char pointer.
Personally I struggle with the char pointer stuff and haven't had time to re-write my guides using those, thus I can only talk brave without any success yet :roll_eyes:

Have fun with your project :slight_smile:

Greetings
Jonathan

Hi NetDevil,

thank you for your congratulations.

I continue to slowly reach a solution and I'm looking for a way to format the "Time" variable, but I can't find a way to do that ?

I tried to format the column of cells, it works, but it is deleted when I start a new capture series.

Do you have any idea how I could force a format?

Regards

ddominique:
I continue to slowly reach a solution and I'm looking for a way to format the "Time" variable, but I can't find a way to do that ?

I tried to format the column of cells, it works, but it is deleted when I start a new capture series.

Hi dominique,

there is indeed a part in the code which formats the column of date and time to be of Excel format upon every ... restart I recall ... maybe within the LABEL command or within the substitution function for TIME and DATE keyword...

Sorry I don't have any PC with Excel at the moment (one broken, one Linux, one without MS Office...).

If it is possible for you please take a look at the VBA code of PLX DAQ within Excel and look for any 'format' keywords. There shouldn't be many and it should be kind of self-explanatory. Please try to adjust yourself or post the code here for us to have a look together if needed.

Greetings

Jonathan

Hi NetDevil,

I don't know VBA well. I can't find the word "format", but I'm not sure I'm in the right VB subroutine.
I send in the appendix what I think is the macro.
I can't find anything about "Format".

Regards

MacroHelp.txt (13.5 KB)

Hi Dominique,

my bad sorry. Got that wrong in my head ...
Actually the calls for CLEARDATA and CLEARSHEET revert your settings for any column back to normal.

So just format the columns by hand the way you want and then remove the first line per function from the VBA code. That way only the data will get removed (2nd line), not your format works.

The VBA code can be found by going Alt+F11 in Excel, then on the left hand side navigation tree open the folder "Forms" and right click "frmStampDAQ" and "Show code". There you can find these two functions:

Private Sub clearData()
    WStoUse.Range("A2:" & Split(WStoUse.UsedRange.Address, ":", , vbBinaryCompare)(1)).NumberFormat = "General"
    WStoUse.Range("A2:" & Split(WStoUse.UsedRange.Address, ":", , vbBinaryCompare)(1)).Value = Null
End Sub

Private Sub clearSheet()
    WStoUse.Range("A1:" & Split(WStoUse.UsedRange.Address, ":", , vbBinaryCompare)(1)).NumberFormat = "General"
    WStoUse.Range("A1:" & Split(WStoUse.UsedRange.Address, ":", , vbBinaryCompare)(1)).Value = Null
End Sub

As said just remove the lines ending in "General" per function and the format will stay the same even after the calls.

Hope this helps :slight_smile:

Hi NetDevil,

Thanks for your help, but i just tried it and it doesn't work. Weird ...

Regards

Macro.txt (38.9 KB)

Hi Dominique,

well ok ... the code looks right and I just gave it a dirty try myself and the format stayed the same.

What is happening in your Excel? Have you first formatted the column and then connected your Arduino? I mean there is no other clear command in the code :-/

Hi Jonathan,

It's no longer a problem, I do my calculations on another sheet.

On the other hand, I use the macro to take time during a jogging, where the runners must do 6 laps.

It would be a disaster, if we inadvertently press the "Disconnect" button, because I erase the sheet when I click on "Connect".

Is there a way to place a security on this "Disconnect" button?

Regards

Hi,

I am a beginner with the Arduino program and I cannot find a way to extract, I would like if possible, I was able to receive the data from an Attiny85 and write it on Excel, this circuit is powered by batteries while it turns off it sends a signal, how do I do it to receive that signal and print on Excel "End data acquisition"

Thanks in advance.



Hi lidas,

if you have the trigger within your Arduino code (e.g. "Battery is empty, I will die in 10 seconds, better send my last commands") then you could use the PLX DAQ functions "SAVEWOORK" and / or "STOPLOGGING" by Serial.println("SAVEWORKBOOK");
Both functions (and many more) are explained within the Beginners Guide Word document. Just take a look there to understand the way.



Hi Dominique

ddominique:
It would be a disaster, if we inadvertently press the "Disconnect" button, because I erase the sheet when I click on "Connect".

I will help you with that issue in a bit but please note before: PLX DAQ is not 100% stable. It might happen to produce crashes either over a long runtime or with a too high baud rate. Please run some realistic tests in advance to avoid an Excel crash in between your use.

ddominique:
Is there a way to place a security on this "Disconnect" button?

Not by default but I think I found a way. Simple solution would be to implement a message box pop up asking you "Sure to abort?" but as this will force excel to put the focus on the message box and freeze the background execution of the code it will most definitely cause a crash of Excel ==> exactly what we want to avoid.

So as a dirty workaround I suggest to use a counter to manage how many times the Disconnect button has to be pressed before it really stops working. From the top of my head (no Excel to verify code....) here is my proposal.

  1. step: define the maximum amount of Disconnect clicks to be needed.
    Therefore please add the following line at the top of the code where all other "Private Const" variables are stored:
Private Const stopCounterMax = 3
  1. step: right above all those "Private Const" variables add the next variable with all the other "normal" ones:
Dim stopCounter as Integer
  1. step: alter the function "Private Sub cmdConnect_Click()". I paste you below the full new function including a) setting the counter to 0 upon connecting, b) increasing the counter each time disconnect is triggered and c) checking if the stopCounterMax is reached and then really disconnecting. A huge part of code is removed from my side for better readability but I guess you should have no trouble finding the correct places within the function. Also there is a line to update the status label each time disconnect is clicked thus you can check if it is working as intended. I also marked each new line:
Private Sub cmdConnect_Click()

    If FlagConnect = False Then
    
        stopCounter = 0 '<<==== new line

        [....]
        [code removed for better readability]
        [....]
        
    Else

        stopCounter = stopCounter + 1 '<<==== new line
        txtStatus2 = "Disconnect clicked " + stopCounter + " of " + stopCounterMax + " times" '<<==== new line
 
        if ( stopCounter >= stopCounterMax ) then '<<==== new line
        
            stopCounter = 0 '<<==== new line
            FlagConnect = False
            Call CommClose(cboPort.Text)
            cmdConnect.Caption = "Connect"
            txtStatus2 = "Disconnected"
            cmdConnect.BackColor = &H8000000F
            cmdPauseLog.Enabled = False
            cmdPauseLog.Caption = "Pause logging"
            PauseLogging = False

       end if '<<==== new line
        
    End If
    
    Exit Sub
    
ConnectErr:
    Call MsgBox("Could not connect." & vbCrLf & "Please check port settings", vbExclamation)
End Sub

Hope this helps and in case of any problems please just revert back.

Greetings

Jonathan

Hello Jonathan,

Thanks for the help, I'll try this today.

I hope that PLX-Daq is reliable, because I have no other solution to help my colleague.

I'm going to place a backup camera to have a double of the result of Jogging.

Thank you for your support.

You're welcome 8)

In case just send a few SAVEWORKBOOK commands every now and then to at least save your intermediate results.

There is a way of solution to make PLX DAQ more stable but I haven't had the time in years to rework the core and do some testing.... bugs me out ever since :-X :cry:
Still looking for someone to maybe back me up on this....