Revision: 1174
Author: jsuijs
Date: Thu Aug  6 13:40:07 2009
Log: cleanup & better resolution at high speeds (tnx Albert)
http://code.google.com/p/jallib/source/detail?r=1174

Modified:
  /trunk/project/delay_calibrate/delay_calibrate.jal

=======================================
--- /trunk/project/delay_calibrate/delay_calibrate.jal  Wed Aug  5 23:15:29  
2009
+++ /trunk/project/delay_calibrate/delay_calibrate.jal  Thu Aug  6 13:40:07  
2009
@@ -1,13 +1,22 @@
--- delay_calibrate.jal
+--  
-----------------------------------------------------------------------------
+-- Title: delay_calibrate.jal
+-- Author: Joep Suijs, Copyright (c) 2009..2009, all rights reserved.
+-- Adapted-by:
+-- Compiler:  >=2.4g
  --
--- This program calls delays and uses timer1 to measure how long they take.
--- The target clock can be changed to any desired value, without the need
--- to change the real clock of the target. This works since both the timer
--- (used for measuring) and the cpu (executing the delay) use the same  
clock.
--- the constant hacked_target_clock must be set at the real clock rate to
--- calculate the proper baudrate of the serial port.
-
-
+-- This file is part of jallib (http://jallib.googlecode.com)
+-- Released under the ZLIB license  
(http://www.opensource.org/licenses/zlib-license.html)
+--
+-- Sources:
+--
+-- Description:
+--    This program calls delays and uses timer1 to measure how long they  
take.
+--    The target clock can be changed to any desired value, without the  
need
+--    to change the real clock of the target. This works since both the  
timer
+--    (used for measuring) and the cpu (executing the delay) use the same  
clock.
+--    the constant hacked_target_clock must be set at the real clock rate  
to
+--    calculate the proper baudrate of the serial port.
+--  
-----------------------------------------------------------------------------

  include 16f88

@@ -41,25 +50,8 @@
  include print
  include ndelay

-;var word TMR1 at TMR1L
-
  t1con = 0x01 ; TMR1ON, prescaler 1 (1 tick = 0.2 us)

-
-procedure aap (byte in abc) is
-   var volatile word xyz = abc
-end procedure
-
-var volatile word noot
-var volatile byte mies
-
-;aap(noot)
-;
-;aap(1000)
-;
-;noot = mies
-;mies = noot
-
  const byte m1[] = "Test "
  const byte m2[] = " us, measured "
  const byte m3[] = " us"
@@ -70,9 +62,9 @@
        interval = 0 - interval
     end if

-   ; calculate tick time in 100ns steps
+   ; calculate tick time in 1ns steps
     var dword tick = target_clock
-   tick = 40_000_000 / tick
+   tick = 4000_000_000 / tick
     case ((t1con & 0x30) / 0x10) of
        1 : block
           tick = tick * 2
@@ -93,9 +85,9 @@
     print_dword_dec(serial_hw_data, setpoint)

     print_string(serial_hw_data, m2)
-   print_word_dec(serial_hw_data, (interval * tick) / 10)
+   print_word_dec(serial_hw_data, (interval * tick) / 1000)
     serial_hw_data = "."
-   print_word_dec(serial_hw_data, (interval * tick) % 10)
+   print_word_dec(serial_hw_data, (interval * tick) % 1000)


     print_string(serial_hw_data, m3)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to