Vb6 Serial Port Communication Example

0 views
Skip to first unread message

Aline Braunbeck

unread,
Aug 4, 2024, 6:32:32 PM8/4/24
to unbrachalep
AsI understand it from User's Manual, GPIO28 and GPIO29 (which are implemented pins in the example) are not used in LAUNCHXL-F28379D, therefore I changed the initilization codes to GPIO42 and GPIO43. But still cant communicate.

Actually, I was looking for a virtual USB communication in the form of:

Microcontroller SCI - USB - PC

(But I couldn't get it does the launchpad supporting a communication like this?)


Consult the pinout or documentation for your serial instrument and make sure you have the correct cables and/or serial interface hardware to connect it to the computer. Refer to the following for more information.


Install the latest compatible version of LabVIEW and the NI-VISA driver. If you are using a NI serial interface device, also install the latest compatible version of the NI-Serial driver. If using a 3rd party cable, check to see if there is an additional driver, especially for USB serial adapters. Refer to the following for compatibility information.


In Measurement and Automation Explorer (MAX), NI-VISA detects the instrument and creates the VISA resource for the serial communications (COM) port that you use to communicate with the instrument.




Expand Devices and Interfaces. You should see the VISA resource name of the COM port listed as ASRL[board][::INSTR]. If you are using an NI serial interface device, the COM port will appear under the interface.


Refer to Choosing the Right Interface to Control Instruments in LabVIEW to determine which instrument driver type is best for your application. Follow the links in the document to install and use the instrument driver.


The instrument driver and NI-VISA driver will install examples and the API required to communicate with your instrument. Use these examples as programming references and an easy way to start using your instrument.




Note: SCPI commands i.e. '*IDN?\n' will only work with devices that support this protocol; Many third party devices will not respond to these commands.



For more information on the NI-VISA serial functions, refer to LabVIEW Help: Serial VIs and Functions.


"The Arduino Due has three additional 3.3V TTL serial ports: Serial1 on pins 19 (RX) and 18 (TX); Serial2 on pins 17 (RX) and 16 (TX), Serial3 on pins 15 (RX) and 14 (TX). Pins 0 and 1 are also connected to the corresponding pins of the ATmega16U2 USB-to-TTL Serial chip, which is connected to the USB debug port. Additionally, there is a native USB-serial port on the SAM3X chip, SerialUSB'. "

This is all of interest to me but useless if I don't know how to program the several ports. There is no hint that I could see on the associated functions/methods appropriate to these Due ports. There should be some kind of hyperlink here. I also get the feeling that some of these ports have different names in other places.


Are pins 0 and 1 really connected to two different ports?

Where is more documentation of the debug port? Is this the Serial Monitor?

How is the word SerialUSB related to the native port? Is it a software keyword?

From browsing documentation for other boards I gather that, for example, Serial1.begin() would activate pins 18 and 19. Is that correct?


Case of Serial is more complex: Pins 0 and 1 are connected to the AVR and to the USB programming port. If the USB programming port is in use (when you program the AVR or when you communicate with the AVR), pins 0 and 1 are connected to the programming port and don't be used for any other usages.


I have to agree with @grimdon, this is crap;

sketch serialpassthrough does not work on the Due. As configured it has serial and serial1 configured BUT the USB programming port shows up on the PC as COM11 and the USB (AB is the only thing I found) shows up on the PC as COM12 BUT (again) what do you call the USB (AB) in the sketch?


A simple pass through loop that fails out of the box... I am not getting a warm and fuzz with the Due...

More GoogleFu produced: How To Use The Native USB Of The Arduino Due For High-Speed Communication - Copperhill

and that resulted in modification of MultiSerial:



/*

Multple Serial test


SerialUSB is the communication function used with the native USB port, Serial with UART (RX/TX) and Serialn(RXn/TXn) with the corresponding USARTp (Serial1 for USART0, Serial2 for USART1, Serial3 for USART3 and Serial4 for USART2 with a few more lines of code for this last one).


In a first Arduino IDE window, select Arduino DUE(Programming Port), Connect the board to your PC, select a Com port accordingly, i.e. for me it's "Port: Com4 (Arduino DUE Programming Port)". Upload this skectch.


Then in another IDE window opened with a right click in your short-cut IDE, select Arduino DUE (Native USB Port), connect the board to your PC with a USB cable, select a Com port accordingly, i.e. for me it's Com 8 (Arduino DUE Native USB Port)".


Whilst Serial1 and Serial2 light up orange when you have them in the code, when you try to compile it results in and 'undefined' error. So that is not much help when you wish to use pins 18 and 19 to communicate with another device using that port.

How does one make sure Serial1 is actually defined and assigned to the correct pins?


Have you checked Serial1 on the DUE side ? The sketch below checks Serial1 and Serial2: connect a jumper wire between RX1/TX2 and another one between RX2/TX1, connect your DUE to the PC side via the programming port:


Yes grounds are connected. The ProMini side works independently.

RX1(DUE) is connected TX(Pro Mini) and RX1(DUE) is connected to TX(Pro Mini).; checked multiple times to make sure I hadn't accidentally connected TX to TX etc.


The Due handles all the LCD driving and the ProMini handles the programmable configuration data and the LocoNet interface. Not a huge amount of data has to flow between them; mostly touch screen info to the ProMini and a few screen change instructions the other way.


Am I allowed to swear on here?

I finally found the problem. A dry solder join on the header on the Due board. It may have even been through plating fault. Reapplying a little flux on both sides and resoldering has fixed it. I gave the board to a friend who inspected it under a microscope at work and just phoned me that it now works.


I'm working on a project that uses a laser range finder that communicates with arduino through TTL, and I have this sketch obtained by the seller of the LRF and it is for UNO which works fine ....

And it uses SoftwareSerial...


Because content scripts run in the context of a web page, not the extension that runs them,they often need ways to communicate with the rest of the extension. For example, an RSSreader extension might use content scripts to detect the presence of an RSS feed on a page,then notify the service worker to display an action icon for that page.


This communication uses message passing, which allows both extensions and content scripts tolisten for each other's messages and respond on the same channel. A message cancontain any valid JSON object (null, boolean, number, string, array, or object). There aretwo message passing APIs: one for one-time requests, and a more complex onefor long-lived connections that allow multiple messages to be sent. For informationabout sending messages between extensions, see the cross-extension messages section.


To send a single message to another part of your extension, and optionally get aresponse, call runtime.sendMessage() or tabs.sendMessage().These methods let you send a one-time JSON-serializable message from a content script to theextension, or from the extension to a content script. To handle the response, use the returnedpromise. For backward compatibility with older extensions, you can instead pass a callback asthe last argument. You can't use a promise and a callback in the same call.


If multiple pages are listening for onMessage events, only the first to call sendResponse() fora particular event will succeed in sending the response. All other responses to that event will beignored.


To create a reusable long-lived message passing channel, call runtime.connect()to pass messages from a content script to an extension page, or tabs.connect()to pass messages from an extension page to a content script. You can name your channel todistinguish between different types of connections.


One potential use case for a long-lived connection is an automatic form-filling extension.The content script might open a channel to the extension page for a specific login, andsend a message to the extension for each input element on the page to request the formdata to fill in. The shared connection allows the extension to share state betweenextension components.


To handle incoming connections for either a content script or an extension page, setup a runtime.onConnect event listener. When another part of yourextension calls connect(), it activates this event and the runtime.Portobject. The code for responding to incoming connections looks like this:


Ports are designed as a two-way communication method between different parts of the extension. A top-level frame is the smallest part of an extension that can use a port.When part of an extension calls tabs.connect(), runtime.connect() or runtime.connectNative(), it creates a Port that can immediatelysend messages using postMessage().


If there are multiple frames in a tab, calling tabs.connect() invokesthe runtime.onConnect event once for each frame in the tab. Similarly, ifruntime.connect() is called, then the onConnect event can fire once for everyframe in the extension process.


You might want to find out when a connection is closed, for example if you're maintaining separatestates for each open port. To do this, listen to the runtime.Port.onDisconnect event. Thisevent fires when there are no valid ports at the other end of the channel, which can have any of the following causes:


In addition to sending messages between different components in your extension, you can use themessaging API to communicate with other extensions. This lets you expose a public API for otherextensions to use.

3a8082e126
Reply all
Reply to author
Forward
0 new messages