Useing the TV screen?
krazyideas
Posts: 119
Hello,
I am useing the TV to display a varaible but the screen keeps rolling so fast I can't read the number.· What is the clear sreen command for the tv terinal???
It should work if I clear the screen and then string dec.term (variable)· Then the number would stay in the upper left corner shouldn't it??
Thanks for any help
I am useing the TV to display a varaible but the screen keeps rolling so fast I can't read the number.· What is the clear sreen command for the tv terinal???
It should work if I clear the screen and then string dec.term (variable)· Then the number would stay in the upper left corner shouldn't it??
Thanks for any help
Comments
Well I am trying to make an RPM Gage.
I have a pules that·goes high·1/2 second and then low 1/2 second.·
I am useing RPM := ((((measure2 - measure1) * 36) / clkfreq) * 60)·to give me RPM. Where Measure2 is the cnt value when the pin goes low and measure1 is the cnt value with the pin goes high.· It just reads Zero.
If I take out the clkfreq out and just have RPM := (Measure2 - Measure1) The number I get varies up and down,· 10_000 counts or so
Is that just the counter's window of error or what?
my program is attached
Thanks for any thoughts
Your code only measure the high pulswith of the RPM sensor. To get the time of a full turn you need to capture the cnt 2 times at the same edge:
to calculate the RPM:
RPM := clkfreq / ((measure2 - measure1) / 60)
Andy
if you REALLY want to know what is going on in your code you have to check EVERY detail
hand upon heart ! How many hours did you spend on trying things with this issue ?
it's not nescessary to answer this question here in the forum. It's enough to answer it to yourself
I want to show you a way of how you can learn a lot of things. At first it might look
like "oh ! So many extra-lines to code ?!?!"
But if you count how many MINUTES it takes to code these lines and compare it to the HOURS
you tryed around with no success the minutes pay off in many hours and days
So here it is:
I prefer a serial connection to debug and check things
and if you take the programming-cable no additional hardware is needed
The basic idea here is:
create a signal that is rocksteady 1Hz 500 milliseconds ON 500 milliseconds OFF
connect this signal to your IO-PIN No 2 (IO-pin-counting starts at zero)
which you use to measure the ON/OFF-time by WAITPEQ/WAITPNE
In the testphase of a program :
If you take SOME signal you don't know exactly what the signal is
and you don't know exactly what your code is doing
these are condition where it is hard to find out what is going on
so you have to reduce the things that are uncontrolled.
Here is a democode showing this with your program
I added an object serial (FullDuplexSerial) and an object heart (heartbeat.spin)
heartbeat.spin starts a cog and make one IO-PIN toggle at a frequency infinitly
this creates the rocksteady signal with 1Hz
you just connect IO-PIN 10 with IO-PIN 2 to have this signal on your waitpeq-pin
Then I wrote some short methods that make it a little bit easier to write
code for debugging what is going on in the code
object heartbeat.spin
and here your sourcecode with added debug-functionality
I added some constants that make it easy to change between very detailed debugoutput and a short output
I renamed some of your variables in that way that the name is REALLY SELFEXPLAINING
you might thing ey man I'm intellgent enough to get things done by shorter easier names !
In a short program you're right. But SELFEXPLAINING names set free brain-capacity for the REAL problem
and as bigger as a program gets as more brain-capacity it sets free
or as more brain-capacity it takes away from analysing the REAL problem !
additional if you take a look into sourcecode with selfexplaining names after months or years
is much easier to remember or understand new what the code does
OK that's enough explaining around it here the code
connect IO-pIN 10 to IO-PIN 2
load this version of code into your propeller and watch the debugoutput with PST.EXE
best regards
Stefan
Post Edited (StefanL38) : 12/14/2008 2:39:26 PM GMT