1Jan

Vba For Excel Serial Communication With Arduino Microcontroller

1 Jan 2000admin

Jun 8, 2015 - Arduino to Visual Basic 2013 Communication. The Arduino Sketch sends the string “1234” over the serial connection once every second.

Dear AVR Pros, i am looking for an easy and affordable way to interface an SPI Daisy chain consisting of 30 or more ATmega8 Slaves with a Windows 7 PC with Excel VBA. I was thinking about an Arduino or something like that to receive serial commands from Excel and translating them to be fed on the SPI bus. Is this actually possible or is there maybe an easier way, such as a USB to SPI adapter which can be talked to via a virtual com port? I guess the AVRISP mkII can't be used for this since i couldn't figure out how to generate custom bytes at its SPI output. I appreciate any kind of input, since i am quite a newbie in microcontrollers. Thank you very much in advance! Best regards.

Thank you guys! @ clawson: after further investigation, the Arduino sounds like a good solution to me.

I hope i didn't overlook any disadvantages which could affect my project. I will only be using one SS-line and daisy chain the slaves together according to this connection scheme: So basically i will be pushing the data through all the slaves and they will filter out whats meant for them using unique addresses. @ awneil: can you tell me what is better about the expensive device, compared to an Arduino or the cheap USB devices you mentioned? I really appreciate your help guys, thank you! I've seen this thread before, but can't see how it relates to the problem.

Of course i will try to make the lines as short as possible, maybe even just stack the master and slave pcbs on top of each other. In post #3 of the mentioned thread there is an example calculation, mentioning a 28 feet distance at 8 mHz SPI clockrate. I don't even think that i will need 8 mHz since i only need to transmit 24 bit to each slave with an update rate of maybe 20 ms. Is there something i'm overlooking? Thank you very much! Best regards.

Prizefighter wrote: @ awneil: can you tell me what is better about the expensive device, compared to an Arduino or the cheap USB devices you mentioned? Well, what constitutes 'better' depends entirely on the particular requirements! You can see an overview of key features & performance here: Trying to think back (it was a couple of years ago), IIRC, the key requirement was for an SPI Slave; which is what ruled-out the FTDI devices - but doesn't matter for you. Also, being a supported off-the-shelf unit, in a proper case, was a big plus. Quote: Can you give me an example how this would be implemented hard- and softwarewise?I can't give you a better example than Google can.:) It has also been discussed here countless times: Consider also I2C (aka TWI) or 1-WIRE.

Your requirement of 24 bits every 20 ms is easily managed by all of those. That's a total of 1.2 kbps per slave. With 30 slaves, that's 36 kbps. Even if you were to add another 8 bits per message for addressing, that's 48 kbps. All of those interfaces can easily handle that speed. RS-485 requires external transceiver chips on each slave.

The others do not. Many AVR support I2C in hardware. Those that don't can 'bit-bang' it. 1-WIRE has no support in hardware, but can easily be bit-banged. There are libraries available for all of these options, so you don't have to re-invent the wheel.

The purpose of this article is to demonstrate how you can perform serial port communication in the VBA (Visual Basic Applications – script editor included in any typical Microsoft Excel distribution) but without using the MSComm control or any other third party add-on or ActiveX. Usb vcom driver for mtk 8127 processor software. Introduction The great advantage of this method, which uses API functions to call the serial port directly, is that you do not really need to install anything on your PC, apart from the Excel itself (which, let’s admit it, already exists on most PCs). Other methods always require the installation of an ActiveX, or at least the registration of an “.ocx” file, like for instance the MSComm control. In order to get access to the VBA script editor, you first need to make the corresponding buttons available on the Excel toolbars (they are not there by default).

These buttons will enable you to launch the editor in which you will be able to write the Visual Basic Code and will also allow you to directly create windows-style controls like textboxes, push buttons, labels, radio buttons, checkboxes etc. In order to make these available on the main toolbar, you need to activate the Control Toolbox button, from the small toolbar activated at the previous step. As a goal for this article, I would intend to demonstrate how you open the serial port, how you write a few bytes, how you read some bytes, and then how you close the serial port. In order to do all these, you will need to create four windows-style buttons, each of them performing one of the tasks that I have enumerated before. Cokolevka importnih kineskopov cvetnogo izobrazheniya. Click on the Command Button control from the recently activated toolbar, and then draw 4 similar buttons anywhere on the surface of your excel worksheet (figure 1). Once you did that, click on the Visual Basic Editor button from the toolbar that you activated in the very first place.