Can we use Visual Basic For Applications (VBA) to code a STM32 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-15 2:12 AM
Hi,
I have a project in which I have to connect my PC to a measurement device thanks to VBA. I would like to use a mcu in order to control a component related to the device. This component is a decoder using the mcu outputs as input signals. These signals changing with time.
I have to control the signals with the code controlling the measurement device. Indeed, they will be changing according to a variable used in this code. Therefore, I would like to know if it is possible to program a MCU such as a STM32L100RCT6 with VBA? And if not, is there any alternative that can help me control this kind of mcu via VBA?
Thank you in advance for your help,
Jay.
Solved! Go to Solution.
- Labels:
-
STM32L1 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-15 7:55 AM
There are different steps:
- The data transfer to the MCU, which can be done via UART communication. To do this, you need an UART interface on the PC, for which you can use a USB-UART converter (this is already integrated on the NUCLEO cards for a virtual COM port called VCP).
- Access from VBA to this COM port: there are several suggestions on the Internet, e. in an article on Stackoverflow
- Define the API, which data should be sent to the MCU and which data you expect in VBA - only those who know the project know how it is or should be defined
- Create the program on the MCU to receive the commands/data and set the peripheral devices accordingly
Good luck!
When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.
/Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-15 5:49 AM
Programming via VBA would require a cross-interpreter, which currently does not exist.
You could define an API between VBA (PC) and MCU and send control data via e.g. a serial interface to the MCU, which provides the parameters for the MCU program.
Regards
/Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-15 6:07 AM
Hi,
thank you for your help. Any ideas on how I could make this API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-15 7:45 AM
Depends what you want to do with it!
Look around at similar systems - see how they do it ...
Some examples:
AT Commands: https://en.wikipedia.org/wiki/Hayes_command_set
MIDI: https://en.wikipedia.org/wiki/MIDI
OSC; https://en.wikipedia.org/wiki/Open_Sound_Control
Firmata: http://firmata.org/wiki/Main_Page
etc, etc, ...
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-15 7:55 AM
There are different steps:
- The data transfer to the MCU, which can be done via UART communication. To do this, you need an UART interface on the PC, for which you can use a USB-UART converter (this is already integrated on the NUCLEO cards for a virtual COM port called VCP).
- Access from VBA to this COM port: there are several suggestions on the Internet, e. in an article on Stackoverflow
- Define the API, which data should be sent to the MCU and which data you expect in VBA - only those who know the project know how it is or should be defined
- Create the program on the MCU to receive the commands/data and set the peripheral devices accordingly
Good luck!
When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.
/Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-16 1:40 AM
I was thinking about a STM32L100RCT6. Is it possible to use two different codes on the same serial port (usb) ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-16 1:43 AM
What do you mean with two different codes?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-16 1:45 AM
One program (VBA) and another one for the MCU.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-16 1:47 AM
Yes, of course. The NUCLEO and DISCOVERY boards working exactly this way and are able to debug/program the board via USB, while having a serial communication (VCP) between the MCU and the PC at the same time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-16 1:48 AM
Alright. Thank you for your help !
