Weird Data Results. Need help understanding
pinkdolphin02
Posts: 13
in BASIC Stamp
So I have been measuring the time delay from a 555 timer with different frequencies running this code:
' {$STAMP BS2}
' {$PBASIC 2.5}
x VAR Bit
DIR14 = 1
DO
x = IN3
OUT14 = x
LOOP
I have been expecting a Normal Bell Curve for a histogram analysis and instead I am getting more bi-model like. Im not sure how to interpret the data. Is there are background process that the Boebot is doing the is affecting the results?
' {$STAMP BS2}
' {$PBASIC 2.5}
x VAR Bit
DIR14 = 1
DO
x = IN3
OUT14 = x
LOOP
I have been expecting a Normal Bell Curve for a histogram analysis and instead I am getting more bi-model like. Im not sure how to interpret the data. Is there are background process that the Boebot is doing the is affecting the results?
Comments
P'raps you could post a schematic and a little something about how you are measuring the output.
Bin Frequency
500 3
600 22
700 28
800 23
900 26
1000 25
1100 18
More 3
Here is the Histogram for the 82K resistor
Bin Frequency
400 0
500 23
600 23
700 19
800 15
900 22
1000 26
1100 20
1200 2
More 0
Here is the Histogram from the 720K resistor. Both of these were made from the data gathered running the code above. This was all done through Excel 2010.
I am not clear on why you're piping the input through the BASIC Stamp 2 I/O pin and right back out. If you read the output of the 555 Timer it will be a real-time reading, however when you pipe that signal into the BASIC Stamp 2 I/O pin with your code what will happen is that the state of the output on the BS2 in relation to the input will be delayed as well as skewed somewhat.
The BS2 will fetch a token from the EEPROM, parse it and execute it, one instruction at a time. When it gets to the line x = IN3 it will place the current state of P3 into x. Next it will output the variable x to P14, however, while this is happenning the state of P3 could be changing, but the BS2 will not be able to update P14 again until the next pass through the loop, at which point IN3 could have been changed for an indeterminate length of time.
*Link to the picture of the 555 timer.*
http://physics.usask.ca/~angie/ep326/lab2/astableschem.jpg
I'm using an Oscilloscope with a single sequence function to look at the time delay between the input and output wave of the microprocessor.
Is there any more info in regards to schematics that you need to understand what I am doing? If so please let me know and I will do my best to provide it. I am sorry for my confusion on what you guys need in order to answer my question and I greatly appreciate the help!
Im doing this as a research project to better understand latency and what effects the micro-controller has on it. So what Im doing is comparing the real time signal from the 555 timer and the signal outputted from the pin, and measuring the time it takes for the signal to pass through. To start off, I wanted to see what the "base" delay was for the processor running the most straight forward code. It was originally just this:
' {$STAMP BS2}
' {$PBASIC 2.5}
DIR14 = 1
DO
OUT14 = IN3
LOOP
However, it got me the same results as the one above did. One of my professor's suggested I tried it "poking at" the code and processor a bit but having it the signal get saved to the memory and see if that had any impact on my results. which it just made the delay longer but still producing a bi modal distribution.
' {$STAMP BS2}
' {$PBASIC 2.5}
DIR14 = 1
DO
OUT14 = IN3
LOOP
it was producing the same results with the bi modal system.
What kind of results are you expecting besides a Gaussian (Normal) distribution?
A Propeller microcontroller running PASM may give you the results you want.
Notice that the highest interval after many samples is 995µS and the lowest is 335. The 995 represents the time to get all the way around the DO:LOOP after having just missed the transition, while 335 represent the shortest path, detection of the transition going right to the output.
This is a case where the signal input period is close to an integer multiple of the DO:LOOP execution time, which is close to 1ms. You are getting into sampling theory!
Thank you so much for this data. Sorry it took me so long to get back, I have been super busy. This really helped me understand what was going on and makes me so happy to find out that I was on the right track but just had to take a whole hell of a lot more data points. I have been looking into sampling theory and its so very interesting stuff. Again I appreciate you help so much.