Searching \ for 'Math functions' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/method/math.htm?key=math
Search entire site for: 'Math functions'.

Truncated match.
PICList Thread
'Math functions'
1994\06\02@221835 by johnsonj

flavicon
face
I am designing a simulator(using a pic) that does a slewing fuction.  It
is for a class project.  Here is my project.
I am makeing a device that will simulate the brakeing of a car.(well
sorta of).  Its not real accurate since I dont take into account a lot of
factors like variable weights and variable braking speeds but its a
project.  As a matter of fact its pretty close to a half-ass design.  But
once again, its all I have to do for the class.  
I give the pic a frequency(8 bit 255 in 1.3Hz increments, 70-400HZ) and
have a jump table that does the
Hz->clock cycles for me.  Now i have 5 bit slew rate(other 3 bits are
someting else) that represents my braking.  The slew is fixed at 330 to
8.3 Hz/sec.  Which translates into 255 to 8.3(?) cycles/second.  Well
here is my problem.  If I only adjust the pulses output per second once a
second it would simulate a vibrater more then a car stopping.  ie once
every second I would slow the car by 10.3 Hz or 330Hz.(like braking in a
YUGO :)  ok another flaw, brakes are not digital(I dont think) put play
with me.  My problem is I dont have and external clock for set time
interupts so I cant decrease the Hz evenly.  So i opted to do everything
on a pulse by pulse basis.  my problem is how do i find what 10.3 Hz(or
8.3 cycles) would add to my pulse period?  I have tried the divide
routines from microchip and found that they have too little acuracy and
generaly dont work worth a flip.  If you dont understand my question
email me, i will try to explain it better.
to sum it up
I need to translate 8.3 cycles/sec into a period to which I can add to
the Current period i am outputting.  this is a problem is the person is
driving at 300Hz and trys to stop at 8.3 cycles a sec(the amount i would
add to each period) then if the person was moving at 200Hz.  Also does
anyone have any math routines that work?  I could use them.
Help me please
       John

_____________________________________________________________________________
John Johnson                   |If it's not OS/2.|spam_OUTjohnsonjTakeThisOuTspamccwf.cc.utexas.edu
                              |It's crap!       |.....johnsonjKILLspamspam@spam@ghostwheel.bga.com
OOOO SSSS    /2222  2222    11 |                 |
O  O S      /    2     2     1 |"We need breath- |"Bite me." Tom Servo
O  O SSSS  /  2222  2222     1 |-ing room!"      |
O  O    S /   2     2    ..  1 |     Bill Gates  |"I want to decide who lives
OOOO SSSS/    2222  2222 .. 111|                 |and who dies" Crow T. Robot
-----------------------------------------------------------------------------


1994\06\03@154529 by johnsonj

flavicon
face


Yea, i had one bouncd.  Dont remeber where from though.  It said no
server responce.  probable just a downed mail server if i had to guess.

Fri, 3 Jun 1994, jory bell wrote:

{Quote hidden}

_____________________________________________________________________________
John Johnson                   |If it's not OS/2.|johnsonjspamKILLspamccwf.cc.utexas.edu
                              |It's crap!       |.....johnsonjKILLspamspam.....ghostwheel.bga.com
OOOO SSSS    /2222  2222    11 |                 |
O  O S      /    2     2     1 |"We need breath- |"Bite me." Tom Servo
O  O SSSS  /  2222  2222     1 |-ing room!"      |
O  O    S /   2     2    ..  1 |     Bill Gates  |"I want to decide who lives
OOOO SSSS/    2222  2222 .. 111|                 |and who dies" Crow T. Robot
-----------------------------------------------------------------------------


1994\06\03@190021 by Don Lekei

picon face
John:

The easiest way to generate a slope in an integer system is to use a
sum-tracking algorythm (y=mx+b where m = dy/dx). Take the ratio of dy:dx
and add dx while the result is negative then subtract dy while the result
is positive.

The sign of the result at each step indicates whether the next step is x or
y (or in your case, whether or not to decrement the frequency on the next
pulse).  The slope can be varied related to another slope to simulate
higher order or non-linear functions.

If you normalize your time constants around 256 then there is no need to
actually do any division or multiplication.

If you still find yourself unable to solve this problem without a decimal
point, may I suggest that you voluntarily check yourself into the Betty
Ford center for the treatment of  "float" addiction <G>.

Hope that helped,
Don




1994\06\03@200116 by johnsonj

flavicon
face
I have solved my problem..  I just quite thinking in terms of HZ and went
to cycles.  Also i got some math routines to work(not bloating but 16bit
at least).  Aslo i did some calculations on my frequencies and found that
this car would be moving between 800mph-2500mps(thats hauling ass).  
Needless to say no cop would ever catch ya.
later
       John

_____________________________________________________________________________
John Johnson                   |If it's not OS/2.|EraseMEjohnsonjspam_OUTspamTakeThisOuTccwf.cc.utexas.edu
                              |It's crap!       |johnsonjspamspam_OUTghostwheel.bga.com
OOOO SSSS    /2222  2222    11 |                 |
O  O S      /    2     2     1 |"We need breath- |"Bite me." Tom Servo
O  O SSSS  /  2222  2222     1 |-ing room!"      |
O  O    S /   2     2    ..  1 |     Bill Gates  |"I want to decide who lives
OOOO SSSS/    2222  2222 .. 111|                 |and who dies" Crow T. Robot
-----------------------------------------------------------------------------


More... (looser matching)
- Last day of these posts
- In 1994 , 1995 only
- Today
- New search...