How To Read Rs232 Data Into Excel
Once this is achieved, you may go ahead and click on the buttons that you have created; each time you press a button, the code from the corresponding function will be Thanks 8 years ago Reply Blake Thanks for the info, really helpful. 6 years ago Reply benny so nice. Did I miss any setting or code that is needed? lngWrSize = -1 lngStatus = SetCommErrorEx("CommWrite (WriteFile)", _ udtPorts(intPortID).lngHandle) GoTo Routine_Exit End If End If For i = 1 To 10 DoEvents Next Routine_Exit: CommWrite = lngWrSize Exit Function Routine_Error: lngStatus have a peek here
Log in to Reply Mauricijus Varnėnas November 20, 2015 Believe it or not, but the fix to my problem was to add the vbCrLf to the end of strData when sending It's easier to debug if we can see the whole macro ! I just started playing around with the code - I am able to connect to the port, but every time I read the data, I have strData returning "". Server & Tools Blogs > Developer Tools Blogs > Beth Massi Sign in Menu Skip to content Executive Bloggers Scott Guthrie Brian Harry Steve Guggenheimer Visual Studio Visual Studio Visual Studio
How To Read Rs232 Data Into Excel
I know comm port events are triggered when data shows up but I cannot figure how to incorporate the events into this code. It runs with VBA7 and older VBAs. udtPorts(intPortID).lngHandle = CreateFile(strPort, GENERIC_READ Or _ GENERIC_WRITE, 0, ByVal 0&, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0) If udtPorts(intPortID).lngHandle = -1 Then lngStatus = SetCommError("CommOpen (CreateFile)") GoTo Routine_Exit End If udtPorts(intPortID).blnPortOpen = True ' Setup Then you can write records to a table using a SQL Insert query or a DAO Recordset with an AddNew.
I put the code at the tail end of Mod Comm routine. You should obviously click the buttons in the order we have discussed. To make it work with COM1, just change the Open statement. But how do i do this?
The formula to convert it is: dd.dddd = ddd + mm.mmmm/60 So, for example, if we want to convert my sample data above to exact Longitude and Latitude in degrees, here's Its important to note that the DataReceived event will fire on a separate thread than your main thread. I can receive the data with Hyper Terminal program of XP on COM1. my site If udtPorts(intPortID).blnPortOpen Then lngStatus = -1 With udtCommError .lngErrorCode = lngStatus .strFunction = "CommOpen" .strErrorMessage = "Port in use." End With GoTo Routine_Exit End If ' Open serial port.
The check reader uses a different baud rate. Because an Access database is placed in a file, then you should select this file in the corresponding field (Fig.2, pos.2). Log in to Reply Rafael Queiroz December 16, 2015 Hi Maurizio!! There is an error in the parameters used to open the com port.
How To Read Serial Port Data In Excel 2010
Services Support Custom Development Industries Industries Clients User Applications Downloads Demos & Files Free Utilities Manuals FAQs Support Software WinWedge TCPWedge TCP/Com B-Coder Barcode ActiveX Barcode DLLs Demo Software Downloads & https://blogs.msdn.microsoft.com/bethmassi/2007/05/05/reading-from-a-serial-port-and-saving-to-a-database/ Thank you Log in to Reply Leave a Reply Cancel reply You must be logged in to post a comment. How To Read Rs232 Data Into Excel lngStatus = GetCommState(udtPorts(intPortID).lngHandle, _ udtPorts(intPortID).udtDCB) If lngStatus = 0 Then lngStatus = SetCommError("CommOpen (GetCommState)") GoTo Routine_Exit End If ' Modify the DCB to reflect the desired settings. Serial Port Data Logger Nothing Happens in Access but I do see the data appear in the WinWedge window.
Share Share this post on Digg Del.icio.us Technorati Twitter Reply With Quote Aug 16th, 2013,12:51 AM #8 Michael M Board Regular Join Date Oct 2005 Location Western NSW Posts 14,578 Re: navigate here couldn't have done it without you. 9 years ago Reply Antonio Bethy Thank you very much for the videos you sent to me. The construction is While…Wend, isn't it? "If lngRdSize > 0″ I changed. A simple DAO example (from within Access) might look like this:(Note: MyTim, MyVal, MyStr are data that you extracted from the alarm string. Serial Data Logger
Urgent please… 2 years ago Reply Gunjan Manan Hi I am fetching data from serial port as mentioned below. I do have the mscomm32.ocx version working as well and I can get that to read based on the .OnComm event. Is there an issue with CreateFile? Check This Out Since Access uses the name of the database as the topic filenames that exceed this limit may be truncated.
Powered by vBulletinCopyright ©2000 - 2017, Jelsoft Enterprises Ltd.Forum Answers by - Gio~Logist - Vbulletin Solutions & Services Home Register New Posts Advertising Archive Privacy Statement Sitemap Top Hosting and Cloud Can you please summarize how it will be the actual coding. A search while ago came up empty.
I wouldn't recommend this option though - not sure how to implement event handling in VBA if that is needed.5.
Sub Button8_Click() Dim intPortID As Integer ‘ Ex. 1, 2, 3, 4 for COM1 - COM4 Dim lngOpenStatus As Long Dim lngWriteStatus As Long Dim lngReadStatus As Long Dim strWriteData As And I want to use Microsoft DLL's (Windows DLL's when possible) When you have a awnser you can mail me at: [email protected] 9 years ago Reply David Thank you for posting If not, I'll just have to stick with you girl! It then updates Form1 with the data.
Thank you again, [email protected] PS I'm restoring a 1972 TVR Vixen 8 years ago Reply Shailesh Your article was very helpful in helping me write my first Serial Port programming App Remove ">0″ of before. It then parses the comma delimited record into the apropriate data types and then uses OBDC to send to the Access data base (you could also use DAO if you wanted this contact form Log in to Reply Maurizio November 20, 2015 Please check if the cable RS232-RS232 works correctly.
Log in to Reply levshkatov October 15, 2015 Thanks a lot, Maurizio, for your help. This will open the environment in which you can write the code for the Visual Basic scripts that will perform the operations you wanted. Log in to Reply sinem November 24, 2015 I realize the problem.
© Copyright 2017 helpwebmaster.net. All rights reserved.