Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Event log analyzing tool

2005-04-26 by Varuzhan Danielyan

Hello!

Here is the link
http://www.edaboard.com/viewtopic.php?t=115101&highlight=excel
but I want to warn you, that first you have to register, and, maybe wait
some time for Free Mirror, or active take part in discussions, to earn
some points for download.
The requirements for Excel and how to make a user form with the
MSComm communication module in Excel'c VBA one can find in the
book.
My code is very simple, so I decided to put it directly into this message.
See it below with some notes.
If somebody succeed in this way with the better functionality, I will be
very interested to know about his results.
Best wishes,

Varuzhan

Module 1 code:

 Public ADCCode As Integer
 Public Evens As Integer
 Public Ch As Byte
 Public Buffer As Variant


Sub DataAcquisition()

  Sheets("Sheet1").Select

  Dim i As Integer
  'UserForm1.InBufferSize = 8192
  UserForm1.MSComm1.CommPort = 4
  UserForm1.MSComm1.PortOpen = True
  UserForm1.MSComm1.Handshaking = comNone
  UserForm1.MSComm1.Settings = "115200,N,8,1"
  'set for 115200 baud, no parity, 8 bits, 1 stop bit
  UserForm1.MSComm1.InputMode = comInputModeBinary
  'binary data returned in variant array
  UserForm1.MSComm1.InputLen = 1
  'set to one character when read by Input
  UserForm1.MSComm1.RThreshold = 0
  'number of characters to receive before
  'generating on comm event
  UserForm1.MSComm1.DTREnable = True
  UserForm1.MSComm1.RTSEnable = False

  UserForm1.MSComm1.InputLen = 1
  'transfer all received bytes when read
  UserForm1.MSComm1.RThreshold = 0
  'interrupt after 1 byte

  ADCCode = 0

  While bEndFlag = False
    DoEvents

    If UserForm1.MSComm1.InBufferCount > 0 Then

      Buffer = UserForm1.MSComm1.Input

      Ch = CByte(Buffer(0))
      If (Ch >= 48) And (Ch < 58) Then
        ADCCode = (10 * ADCCode) + Ch - 48
      ElseIf Ch = 13 Then
        ADCCode = ADCCode + 2
        Events = Events + 1
        Cells(1, 1) = Events
        Cells(ADCCode, 1) = Cells(ADCCode, 1) + 1
        ADCCode = 0
      End If

    End If
  Wend
End Sub

Sub ForceStop()
  'UserForm1.MSComm1.RThreshold = 0
  'disable interrupts- sometimes the click happens
  'while the inrerrupt is being serviced
  'if this isn't here the click may have no effect
  'in those circustances
  UserForm1.MSComm1.PortOpen = False
  'close the port
  Sheet1.cmdStart.Enabled = True
  Sheet1.cmdStop.Enabled = False
  bEndFlag = True

End Sub

Private Sub Workbook_Open()
Sheet1.cmdStart.Enabled = True
Sheet1.cmdStop.Enabled = False
End Sub

UserForm1 Code:

Private Sub MSComm1_OnComm()

Static ADCCode As Integer
Static Ch As Byte
Static Buffer As Variant

  Select Case MSComm1.CommEvent
    Case comEvReceive

      Buffer = MSComm1.Input

      Ch = CByte(Buffer(0))
      If (Ch >= 48) And (Ch < 58) Then
        ADCCode = (10 * ADCCode) + Ch - 48
      ElseIf Ch = 10 Then
        Cells(1, 1) = ADCCode
        Cells(ADCCode + 2, 1) = Cells(ADCCode + 2, 1) + 1
        ADCCode = 0
      End If

    Case Else
  End Select

End Sub

Private Sub UserForm_Click()

End Sub

Notes:  The readout code in the OnComm() newer works, because
I assign 0 to the  UserForm1.MSComm1.RThreshold.  I gust preserve
it for eperiments.
It is strange, but the interrupt driven (I suppose) code in the OnComm()
function works much more slowly, than the same code being polled in the
Module 1.



----- Original Message ----- 
From: "Michael Anburaj" <embeddedeng@...>
To: <lpc2000@yahoogroups.com>
Sent: Tuesday, April 26, 2005 2:27 AM
Subject: Re: [lpc2000] Event log analyzing tool


>
> Great!
>
> Thanks a lot Robert & Varuzhan for sharing these info.
> with me. Now I need to try them.
>
> Varuzhan,
> Could you also send me a link for this ebook? And if
> possible more info. on your work.
>
> Thanks a lot & have a nice evening,
> -Mike.
>
> --- Varuzhan Danielyan <dan@...> wrote:
> > To the Robert's advice to use a spreadsheet I want
> > to add, that Excel can
> > be used even on-line, to read and visualize (as a
> > scope) the data directly from
> > ports, both COM and LPT.  This is described in a
> > very nice book of Aubrey Kagan "Excel by Example",
> > which is available also
> > as e-book on www.edaboard.com site.
> > I have used this feature of Excel to make a very
> > simple, but very efficient
> > multichannel pulse width analyzer, which consists of
> > a Keil MCB2100
> > evaluation board, direct serial port cable and PC.
> > The Keil board sends
> > data through its COM0 port and Excel reads and shows
> > the spectrum in
> > real time.
> >
> > Varuzhan
> >
> >   ----- Original Message ----- 
> >   From: Robert Adsett
> >   To: lpc2000@yahoogroups.com
> >   Sent: Monday, April 25, 2005 9:09 PM
> >   Subject: Re: [lpc2000] Event log analyzing tool
> >
> >
> >   At 10:08 PM 4/24/05 -0700, Michael Anburaj wrote:
> >   >Full story:
> >   >I have developed a Event log mechanism to trap
> > various
> >   >events that occur at run-time within the Wireless
> > MAC
> >   >engine I am working on at present. Each log entry
> >   >consists a Event number, system time & (1 to 3
> >   >parameters). I have huge buffers for trapping
> > events
> >   >for a long time & later dump them for analysis
> > over
> >   >the console port - which can be piped into a
> > (ASCII)
> >   >file.
> >
> >   That makes sense I've done similar things for
> > debugging and tuning.
> >
> >   >At present I go through these entries without
> > help of
> >   >any tool near problem areas manually. A simple
> > perl
> >   >script can make things better \ufffd by calculating
> > the
> >   >delta between each event. It will be even better
> > if I
> >   >can find a utility that can Graphically displays
> > the
> >   >trend for each event & do all the things one can
> > do on
> >   >a LA or a DSO \ufffd considering each event to a
> > different
> >   >channel on the LA.
> >   >
> >   >Sample EventLog (console dump):
> >   >Event name Time (us) Param1     Param2    Param3
> >   >TX_HW      260040    0x400078   1               0
> >   >TX_FREE    260076    0x400298   0               0
> >   >RX_INT     260082    3          0               0
> >   >ARQ_RE     260123    0x400298   7
> > 23
> >   >
> >   >
> >   >Let me know if such a tool exist.
> >
> >
> >   I don't know of a tool that does exactly what you
> > want.  In the past
> >   however I've used a couple of off the shelf tools
> > to achieve your
> >   ends.  I've heavily used spreadsheets for trend
> > analysis, I just dump the
> >   data as a csv file and import it.  Spreadsheet
> > usually have acceptable if
> >   not great graphing tools.  It should be fairly
> > straightforward to transform
> >   your data into a column per event form.
> >
> >   The companion tool would be a database tool that
> > allows ad-hoc queries.  I
> >   really like Approach for this.  You can make
> > Access do it but it takes more
> >   work.  You can then filter by event,  time, etc..
> > and either use the tools
> >   built-in graphing tools or export the data to a
> > spreadsheet as needed.
> >
> >   The big thing that is missing compared to a DSO is
> > the presence of cursors
> >   to make it easier to read data directly off of the
> > graph.
> >
> >   If you find something else let us know, I wouldn't
> > mind adding another tool
> >   like that to my quiver.
> >
> >   Robert
> >
> >   " 'Freedom' has no meaning of itself.  There are
> > always restrictions,   be
> >   they legal, genetic, or physical.  If you don't
> > believe me, try to chew a
> >   radio signal. "  -- Kelvin Throop, III
> >   http://www.aeolusdevelopment.com/
> >
> >
> >
> >
> --------------------------------------------------------------------------
----
> >   Yahoo! Groups Links
> >
> >     a.. To visit your group on the web, go to:
> >     http://groups.yahoo.com/group/lpc2000/
> >
> >     b.. To unsubscribe from this group, send an
> > email to:
> >     lpc2000-unsubscribe@yahoogroups.com
> >
> >     c.. Your use of Yahoo! Groups is subject to the
> > Yahoo! Terms of Service.
> >
> >
> >
> > [Non-text portions of this message have been
> > removed]
> >
> >
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.