Hoe RS232 naar Excel Macro VBA Data Acquisition te lezen

Inhoudsopgave:

Hoe RS232 naar Excel Macro VBA Data Acquisition te lezen
Hoe RS232 naar Excel Macro VBA Data Acquisition te lezen

Video: Hoe RS232 naar Excel Macro VBA Data Acquisition te lezen

Video: Hoe RS232 naar Excel Macro VBA Data Acquisition te lezen
Video: Wachten op de Ace TWO, Ace One te koop 2024, April
Anonim

In deze zelfstudie wordt uitgelegd hoe u een bidirectionele realtime communicatie tot stand brengt tussen Microsoft Excel en uw RS232 COM-poortapparaten zoals een weegschaal, naderingslezer, streepjescodelezer, temperatuursensor, schuifmaat, micrometer, meter. Deze oplossing maakt gebruik van de software "Bill Redirect" met de "Excel Plugin" om eenvoudig uw randapparatuur aan te sluiten en de gegevens te ontvangen en te verzenden. De communicatie tussen Microsoft Excel en uw apparaat verloopt via een directe DDE-koppeling. Na elke van uw apparaat ontvangen gegevens kan een Excel-macro worden aangeroepen om de ontvangen gegevens te valideren. Deze oplossing legt uit hoe u een opdracht via VBA naar uw apparaat kunt sturen en uw apparaat volledig kunt bedienen. Geen programmering of extra hardware nodig!

Stappen

Deel 1 van 6: Software installeren (RS232- en DDE-communicatie tot stand brengen)

Lees RS232 naar Excel Macro VBA Data Acquisitie Stap 1
Lees RS232 naar Excel Macro VBA Data Acquisitie Stap 1

Stap 1. Download en installeer Bill Redirect-software:

www.billproduction.com/Bill_COMtoKB. ZIP. Deze software wordt gebruikt om de communicatie met uw RS-232 COM-poortapparaat tot stand te brengen.

Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 2
Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 2

Stap 2. Download en installeer de Excel-plug-in

Dit is op https://www.billproduction.com plugin_DDE.zip. Deze plug-in software wordt gebruikt om de communicatie met Microsoft Excel via DDE tot stand te brengen

Deel 2 van 6: Bill Redirect-software (algemene configuratie)

Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 3
Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 3

Stap 1. Start de software: Bill Redirect. Het standaardwachtwoord om de configuratie te bewerken is: www.billproduction.com.

Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 4
Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 4

Stap 2. Schakel alle secties uit, behalve de seriële poort en plug-in

  • Stel in sectie "Seriële poort" de schakelaar in op: Op.
  • Zet in sectie "Plugin" de schakelaar op: Op.

Deel 3 van 6: Bill Redirect-software (RS232 seriële poortconfiguratie)

Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 5
Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 5

Stap 1. Klik op: Seriële poortconfiguratie.

Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 6
Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 6

Stap 2. Voer het seriepoortnummer in waarop uw apparaat is aangesloten

  • Als de achtergrondkleur groen is, betekent dit dat de seriële poort werkt en dat de poort open is.

    Selecteer de Bauds, pariteit en databits geconfigureerd in uw apparaat.

Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 7
Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 7

Stap 3. Klik op de knop: Configuratie opslaan

Als je een RS-232 naar USB converter gebruikt om je apparaat op de computer aan te sluiten, is het voor een goede stabiliteit belangrijk om een converter met FTDI chipset te gebruiken

Deel 4 van 6: Microsoft Excel (algemene configuratie)

Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 8
Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 8

Stap 1. Begin:

Microsoft Excel

. Deze oplossing is compatibel met alle Excel-versies en talen!

Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 9
Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 9

Stap 2. Maak een in Excel a: nieuw leeg document.

Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 10
Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 10

Stap 3. Zorg ervoor dat de bladnaam is: Blad1.

Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 11
Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 11

Stap 4. Sla uw Excel-document op in: C:\BillProduction. CFG\MyFile.xlsx.

Deel 5 van 6: Configuratie van Excel-plug-in

Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 12
Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 12

Stap 1. Start de Excel-plug-in

Het standaardwachtwoord om de configuratie te bewerken is: www.billproductie.com.

  • Belangrijk: De TCP-verbindingsstatus moet aangeven: Aansluiten. Als het niet mag Aansluiten zorg er vervolgens voor dat Bill Redirect Software is geopend.
  • In de proefmodus moet u de software Bill Redirect na elke 15 minuten opnieuw opstarten om uw test voort te zetten."
Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 13
Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 13

Stap 2. Klik in de Excel-plug-in op het mappictogram en selecteer uw Excel-bestand dat u eerder hebt gemaakt

  • Als alles in orde is, geeft de DDE-verbindingsstatus het volgende aan: Aansluiten.
  • Op dit punt wordt de communicatie met uw apparaat tot stand gebracht via Excel. De gegevens die van uw apparaat worden ontvangen, worden verzonden in Excel.
Lees RS232 naar Excel Macro VBA Data Acquisitie Stap 14
Lees RS232 naar Excel Macro VBA Data Acquisitie Stap 14

Stap 3. Test je communicatie met Excel

Gebruik de knop: Test DDE. Gebruik de sectie om te zien wat uw apparaat verzendt of ontvangt Debugger in Bill Redirect.

Deel 6 van 6: Er zijn verschillende opties beschikbaar

Lees RS232 naar Excel Macro VBA Data Acquisitie Stap 15
Lees RS232 naar Excel Macro VBA Data Acquisitie Stap 15

Stap 1. Overweeg voorbeeld #1: ' Roep een Excel-macro op na elke ontvangen gegevens:

  • Voer eenvoudig uw macronaam in het veld Macro uitvoeren:
  • Gebruik de knop rechts om de aanroep van uw macro te testen.
Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 16
Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 16

Stap 2. Overweeg voorbeeld #2: ' Stuur een commando naar je apparaat via VBA:

Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 17
Lees RS232 naar Excel Macro VBA Data-acquisitie Stap 17

Stap 3. Gebruik deze VBA Excel-broncode om een gegevensopdracht van Excel naar uw apparaat te verzenden:

  • ChannelNumber = DDEInitiate("BPEXCEL", "BPEXCEL")
  • DDEExecute ChannelNumber, "{TX_SERIAL[Hallo woord!{ASCII:13}]}"
  • DDETerminate ChannelNumber
  • Vervang de opdracht Hallo woord! {ASCII:13} door het gewenste commando.
  • Aanvullende documentatie.
  • Excel Plugin volledige handleiding met alle uitleg:
  • /Bill_DDE_over_Ethernet.pdf.
  • Bill Redirect Software volledige handleiding met alle commando's:

    www.billproduction.com

  • /Bill_Redirect_Manual.pdf.

Aanbevolen: