Hi Folks,
I am trying to find the most perplexing bug I have had in a vb.net app to
date.
Here is some code:
Dim Data as Short
Data = Me.ReadPMAPDigi ts(pmOffsets.AP IAS)
Trace.WriteLine If(blnErrorLogg ing, Now.ToString & ": Raw IAS: " &
Data.ToString, "Data")
'Mask off everything but lowest 10 bits - we only need values below 511 and
no negative values
Data = Data And CShort(&H3FF)
Trace.WriteLine If(blnErrorLogg ing, Now.ToString & ": IAS: " &
Data.ToString, "Masked Data")
'Trap outliers
If Data > CShort(511) Then
Trace.WriteLine If(blnErrorLogg ing, Now.ToString & ": E-IAS: " &
Data.ToString, "Error")
Me.GlobalErrorC ount += 1
Exit Function
End If
The function this code comes from resides in a "super loop" (called via
nonthreaded delegate invocation every 60ms), reads airspeed from a flight
simulator (via interprocess communication) and returns a short value that
typically is in the range of 0-400 and for the following data was fixed at
120. Here is a snippet of logged data that repeated for about 5 minutes:
Data: 5/26/2004 10:16:16 PM: Raw IAS: 120
Masked Data: 5/26/2004 10:16:16 PM: IAS: 120
Data: 5/26/2004 10:16:16 PM: Raw IAS: 120
Masked Data: 5/26/2004 10:16:16 PM: IAS: 120
Data: 5/26/2004 10:16:16 PM: Raw IAS: 120
Masked Data: 5/26/2004 10:16:16 PM: IAS: 120
So far so good. But then...
Data: 5/26/2004 10:03:13 PM: Raw IAS: 120
Masked Data: 5/26/2004 10:03:13 PM: IAS: 120
Error: 5/26/2004 10:03:13 PM: IAS: 131072
Data: 5/26/2004 10:03:13 PM: Raw IAS: 120
Masked Data: 5/26/2004 10:03:13 PM: IAS: 120
Error: 5/26/2004 10:03:13 PM: IAS: 131072
Now can somebody tell me 1) How can the variable "Data" change from the 2nd
Trace.writeline to the third Trace.writeline (all I did was compare it to a
constant in between) *and* 2)How it got stuffed with decimal 131,072 - a
value too large to be represented by a short???? How might I stop this?
Help! I'm losing my mind over this and even with error trapping it's
ruining my program.
Scott 1 1059
Turns out I *had* solved the bug - in THIS function. Unfortunately a
similar function that checked a different source for airspeed *also* had an
error trace identical to the one in question - and it was *that* function
that was generating the "ghost" error.
<blush> Sorry!
Scott
"petdoc" <pe************ ***@comcast.net > wrote in message
news:d8******** ************@co mcast.com... Hi Folks,
I am trying to find the most perplexing bug I have had in a vb.net app to date.
Here is some code:
Dim Data as Short
Data = Me.ReadPMAPDigi ts(pmOffsets.AP IAS) Trace.WriteLine If(blnErrorLogg ing, Now.ToString & ": Raw IAS: " & Data.ToString, "Data")
'Mask off everything but lowest 10 bits - we only need values below 511
and no negative values Data = Data And CShort(&H3FF) Trace.WriteLine If(blnErrorLogg ing, Now.ToString & ": IAS: " & Data.ToString, "Masked Data")
'Trap outliers If Data > CShort(511) Then Trace.WriteLine If(blnErrorLogg ing, Now.ToString & ": E-IAS: " & Data.ToString, "Error") Me.GlobalErrorC ount += 1 Exit Function End If
The function this code comes from resides in a "super loop" (called via nonthreaded delegate invocation every 60ms), reads airspeed from a flight simulator (via interprocess communication) and returns a short value that typically is in the range of 0-400 and for the following data was fixed at 120. Here is a snippet of logged data that repeated for about 5 minutes:
Data: 5/26/2004 10:16:16 PM: Raw IAS: 120 Masked Data: 5/26/2004 10:16:16 PM: IAS: 120 Data: 5/26/2004 10:16:16 PM: Raw IAS: 120 Masked Data: 5/26/2004 10:16:16 PM: IAS: 120 Data: 5/26/2004 10:16:16 PM: Raw IAS: 120 Masked Data: 5/26/2004 10:16:16 PM: IAS: 120
So far so good. But then...
Data: 5/26/2004 10:03:13 PM: Raw IAS: 120 Masked Data: 5/26/2004 10:03:13 PM: IAS: 120 Error: 5/26/2004 10:03:13 PM: IAS: 131072 Data: 5/26/2004 10:03:13 PM: Raw IAS: 120 Masked Data: 5/26/2004 10:03:13 PM: IAS: 120 Error: 5/26/2004 10:03:13 PM: IAS: 131072
Now can somebody tell me 1) How can the variable "Data" change from the
2nd Trace.writeline to the third Trace.writeline (all I did was compare it to
a constant in between) *and* 2)How it got stuffed with decimal 131,072 - a value too large to be represented by a short???? How might I stop this?
Help! I'm losing my mind over this and even with error trapping it's ruining my program.
Scott This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: python newbie |
last post by:
hey,
okay, I'm trying to figure out why my books: Quick Python, Python in a
Nutshell, Python Cookbook and Learning Python don't say anything about the
weird behavior of a list when you have one as an object instance member.
for instance (my first pun of 2004), if I have,
test.py
----------------
|
by: Tommytrojan |
last post by:
Hi,
I have been using Python for a while but today I came across a really
strange behavior:
While poking around in Queue.py due to problems with importing this
module from a thread I got an error that a module that I imported on
top of the file could not be accessed. I reduced the problem to this
small script:
|
by: Alan Little |
last post by:
I started with the following code in an included file:
$CompanyBlock =
"$Company (Booth#: $Booth)\n".
"$Address\n".
"$City, $State $PostalCode\n".
"$Website\n".
"$Contact1, $Title1\n".
"Tel: $Phone\n".
"Fax: $Fax\n".
|
by: cody |
last post by:
I have a very funny/strange effect here.
if I let the delegate do "return
prop.GetGetMethod().Invoke(info.AudioHeader, null);"
then I get wrong results, that is, a wrong method is called and I have no
clue why.
But if I store the MethodInfo in a local variable I works as expected.
I do not understand why this is so, shouldn't both ways be semantically
equal?
|
by: XYZ |
last post by:
I need to pass the address of a variableto some win32 API functions like
RTLMoveMemory
I noticed some weird behavior when pinning objects and using the handle's
pointer to write data to the memory location.
it seems as if after pinning an object the memory and the object are not
updated at the same time anymore
| |
by: Pupeno |
last post by:
Hello,
I am experiencing a weird behavior that is driving me crazy. I have module
called Sensors containing, among other things:
class Manager:
def getStatus(self):
print "getStatus(self=%s)" % self
return {"a": "b", "c": "d"}
and then I have another module called SensorSingleton that emulates the
|
by: elias.farah |
last post by:
Hello Everyone,
I'm having some very weird behavior on a couple of Access forms. (Not
all forms, just some of them).
The forms have been working for years, under Access XP/2003 etc, and
last week upgraded from Windows XP/Office 2003 to Vista x64/Office
2007.
Under Access 2007, a couple of forms are now taking 60 seconds to
|
by: Matt Nordhoff |
last post by:
Sebastjan Trepca wrote:
Python doesn't like when you read a variable that exists in an outer
scope, then try to assign to it in this scope.
(When you do "a = b", "b" is processed first. In this case, Python
doesn't find a "value" variable in this scope, so it checks the outer
scope, and does find it. But then when it gets to the "a = " part...
well, I don't know, but it doesn't like it.)
|
by: =?Utf-8?B?TU5C?= |
last post by:
Hi there!
We are near the ending stage of an ASP.NET + IIS project, and started doing
stress testing on the servers. We find ourselves with a very strange
behavior, that can’t figure out since several days ago. Hitting the websites
with 500 user clicks every 1 second, in ANY of the interior pages (those are
not the default one), takes the ASP.NET process to about 80% of CPU usage. If
instead we just go to the root, the CPU doesn’t...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |