K8055 VM110 Digital Input Counter

I bought a vm110 USB interface board and a PM-U24 (NPN) photocell. The photocell counts the recesses of a disk and the demotoll counts this signals. Know I need a programm which give every count a time and put the counts and time of the respective count in a table.

I don’t know anything about programming so please help me.
I have Windows XP and Windows 7

If you have Microsoft Excel you can use the VBA macro examples in this thread:
viewtopic.php?f=3&t=300

To use the VBA (Visual Basic for Applications) you have to know some basic principles of Visual Basic programming language.

Please download the latest K8055 software package with the new K8055D.DLL:
velleman.eu/downloads/files/ … rsion4.zip
In the examples folder there is a ready to run Excel VBA demo.

J’ai fais un programme recuperant le nombre de flacon en fonction du temps sur excel en visual basic avec la digital input 1 du VM110 de plus j’ai programmé une sauvegarde automatique avec aussi une creation et changement de fichier chaque jour

'-------------------------------------------------------------------------------------------------------------------------
'//////////////////////////////////////////////////////////////////////////////////////////////////////////// ' ////////////////////////PREMIER CAPTEUR //////////////////////////////////////////////////////////

'
'Je lance le programme au démarrage
'Lancer un programme au démarrage du PC -> Sans toucher au registre( menu Démarrer )



Private Declare Function SetTimer Lib "user32" ( _
ByVal HWnd As Long, ByVal nIDEvent As Long, _
ByVal uElapse As Long, ByVal lpTimerFunc As Long)
Private Declare Function KillTimer Lib "user32" ( _
ByVal HWnd As Long, ByVal nIDEvent As Long)
Private Declare Function OpenDevice Lib "K8055D.DLL" (ByVal CardAddress As Long)
Private Declare Function ReadAllDigital Lib "K8055D.DLL" ()
Private Declare Function ReadIOchannel Lib "K8055D.DLL" (ByVal Channel As Long)

Dim TimerID As Long
Dim TimerSeconds As Single
Dim Connected As Boolean


Module Module1
Sub Main()

        'Initialisation des variables
        
        Dim Byt As Long
        Byt = ReadIOchannel(1)
        Dim Date_jour As Date
        Dim heure As Date
        Dim N As Integer
        N = 0
        
                
        
        'Boucle infinie /!\
        While 1

            'Récupération de la date actuelle

            Date_jour = Date_jour.ToShortDateString 'je recupere que jour/moi/année
            heure = heure.ToLongTimeString  'je recupere que heure/min/sec



'///////////////////////////// TEST CHANGEMENT DE JOUR ///////////////////////////////////

                          If Date_jour <> Worksheets("Production en cours 1").Cells(N, 3).Value Then
                          
                            'creer nouveau classeur
                        
                   
                                Dim D As String
                                D = Day(Now) & Month(Now) & Year(Now) & "_" & Hour(Now) & Minute(Now)
                                Workbooks.Add
                                 ChDir "C:\Documents and Settings\moi\Bureau"
                                 ActiveWorkbook.SaveAs Filename:= _
                              "C:\Documents and Settings\moi\Bureau\Production en cours 1_" & D & ".xlsx", _
                                FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False


'///////////////////////////// DEFINITON DES COLONNES ///////////////////////////////////
    'On nomme les colonnes
    
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "Nombre de Flacon"
    Range("A2").Select
    Columns("A:A").ColumnWidth = 16.71
    Range("B1").Select
    ActiveCell.FormulaR1C1 = "Heure"
    Range("C1").Select
    ActiveCell.FormulaR1C1 = "Date"
    Range("C2").Select


'///////////////////////////// LES VARIABLES   ///////////////////////////////////

                Dim nb_flacon As Integer
                nb_flacon = 1
              
              

'///////////////////////////// Remplissage du tableau ///////////////////////////////////

' Remplir 3 colonnes : une disant le nombre de flacon et une les jours et l'autre les heures



If (Byt = 1) Then
' prévoir un anti rebond avec détection de front descendant

     
     
ActiveSheet.Cells(N, 1).Value = nb_flacon


'j'incremente mon nombre de flacon
nb_flacon = nb_flacon + 1


ActiveSheet.Cells(N, 2).Value = heure


ActiveSheet.Cells(N, 3).Value = Date_jour

'j'avance d'une ligne
N = N + 1

'///////////////// Function sauvegarder ///////////////////////////////////////
'pour sauvegarder tout les 100 flacons
Dim Save As String
Save = nb_flacon / 100

'Save : valeur booléen. Vrai si c'est un entier, faux sinon.
Function Entier(ByVal Save) As Boolean
Entier = Int(Save) = Save
End Function


If Save = 1 Then
    ActiveWorkbook.Save
      End If

                                           
End If
   
    Else
'///////////////////////////// CHANGEMENT DE JOUR ///////////////////////////////////
    
              ' Subtract one day.
              Dim today As DateTime
              Dim Yesterday As DateTime
              today = System.DateTime.today
              Yesterday = today.AddDays(-1)

                ' Write the yesterday value.

                              ChDir "C:\Documents and Settings\moi\Bureau"
                             ActiveWorkbook.SaveAs Filename:= _
                             "C:\Documents and Settings\moi\Bureau\Production flacon 1_" & Yesterday & ".xlsx", _
                            FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
                            
    
   
End Function
End Sub

                

auriez vous des corrections à faire svp