Visual BASIC serial communication with ARM

Questions on UARTs, and serial communication
Post Reply
basicchip
Posts: 985
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Visual BASIC serial communication with ARM

Post by basicchip » Thu Jan 24, 2013 8:22 pm

We often get asked about communicating between a PC and the ARM in BASIC. The USB connection emulates a serial port and can be used to transfer data/control between the PC and the ARM processor.

Attached here is a simple example in Visual BASIC that sets up a communication link between a PC and the ARM chip. It also has a simple BASIC program on the ARM side that uses that serial link.
Attachments
Cor_UART_v1.zip
VB project and ARM BASIC example program
(25.31 KiB) Downloaded 507 times



YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: Visual BASIC serial communication with ARM

Post by YahooArchive » Wed Jan 30, 2013 4:06 pm

This post pre-dates the code posting above

I have tried to do this task without any success.

All I am trying to do is the following:

After I have downloaded my code to ARMmite PRO to sense the external world
through the USB dongle, I want to pull the USB cable out while PRO does its job.
Now I want to reconnect the same USB cable back and this time, PRO should report
back to my VB code running on the PC what it found.

This has not worked so far. Any suggestions any one?

If I have to cut and mutilate PRO board, I am willing to do that.
Which line in the ARMmite Pro board should be cut to make the serial
communication to PC work?

I was trying to connect with PC using VisualBasic but with no success. Thanks,

Victor

YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: Visual BASIC serial communication with ARM

Post by YahooArchive » Wed Jan 30, 2013 4:07 pm

follow this link for communicating from VB to a microcontroller, in this case a
BASIC stamp, but the same works for the ARM

http://www.theabramgroup.com/basicstamp/
http://www.rentron.com/receiving_data.htm

And use this adapter to disable reset from the PC (scroll to the end of the
page)

http://www.coridiumcorp.com/ARMhelp/scr/HwSCHrs.html

YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: Visual BASIC serial communication with ARM

Post by YahooArchive » Mon Feb 11, 2013 1:29 pm

>from the help line
>The piece I am missing is how to automate the process of sending the controller
a different command based on the value in the text file. How would such a thing
be accomplished? I am creating a form in VB6 (could be VB.NET) to allow a user
to change the value in the text file that ultimately will control the switch.

>Another approach, if it is possible is to send commands directly to the
controller using VB6 or .NET. Are there VB6 or VB.NET controls that would let
me send commands directly to the controller?

You will need to write an application on the PC using VB for instance. The
ARMmite looks like a serial port to the PC. So the VB program will need to open
the serial port and send characters out to the BASIC program running on the
ARMmite.

It can be as simple as sending a 1 or a 0 and the BASIC program reading that
character with RXD0 and turning the switch on or off.

Various links to sample programs pasted above

YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: Visual BASIC serial communication with ARM

Post by YahooArchive » Mon Feb 11, 2013 1:30 pm

VB Express can be freely downloaded from Microsoft

YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: Visual BASIC serial communication with ARM

Post by YahooArchive » Mon Feb 11, 2013 1:38 pm

Here is some VB6 code I am using on an ARMite controller where I am doing the
same thing-- drop the MSCOMM control onto your form- these values are set when
the form initializes-
' MSComm1.CTSHolding = False
MSComm1.Settings = "19200,n,8,1"
MSComm1.DTREnable = False
'MSComm1.CDHolding = False
'MSComm1.DSRHolding = False
MSComm1.DTREnable = False
MSComm1.Handshaking = comNone
MSComm1.RThreshold = 1
MSComm1.RTSEnable = False
MSComm1.SThreshold = 1
MSComm1.CommPort = Comm_port ' Comm_port is the pot number you are using
MSComm1.PortOpen = True

Here is the code that actually sends data out the serial port-
Frm_Main.MSComm1.Output = tag 'tag is a string variable
While Frm_Main.MSComm1.OutBufferCount > 0 'Wait for data to all be sent
ret = DoEvents() Wend
Hope this helps

YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: Visual BASIC serial communication with ARM

Post by YahooArchive » Mon Feb 11, 2013 1:49 pm

Thanks guys. I was able to work on my project over the holidays and got
everything working because of the examples you provided. I ended up going with
a .net solution because MScomm had too many problems with Windows security.
Again, thanks for your help...you provided exactly what I needed.

Post Reply