Time Period of Timer1


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Mar 2006
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Address vs Value

    Hello,

    I think the following code is not doing what you expect.

    Timerset = $292B ' 22 ms with prescale of 1:2 dec 10541
    The above line looks like it is setting the value of a variable.

    movlw LOW(Timerset) ; 1 instruction cycle
    This line takes the address of the variable in ram, it does not use its value.

    addwf TMR1L,F ; 1 instruction cycle
    movlw HIGH(Timerset) ; 1 instruction cycle
    addwfc TMR1H,F ; 1 instruction cycle

    If you never change the timeout value, you could change to something like
    TIMERSET EQU $292B
    and the movlw LOW(TIMERSET) will work.

    If you want to change the timeout value at runtime
    use something like

    movfw TimerSet+1 ; Get the low byte of TimerSet variable
    addwf TMR1L, F
    movfw TimerSet ; Get the high byte of TimerSet variable
    addwfc TMR1H, F

    Keith

  2. #2
    Join Date
    Jan 2007
    Location
    Colorado
    Posts
    2


    Did you find this post helpful? Yes | No

    Default That was it

    Keith, you hit the nail on the head , thank you. It works. I had all the rest of the code going except the timer. I got it going using The Timerset as a constant, and that did it. I now have a RTTY Teletype.

    I still would like the time to be a variable so I could tune it a bit, but my assembler does not know about movwf. it will assemble movfw, so now to figure that one out....

    I have not programmed assembler for many years. I first learned FAP(fortran assembler program) in 1964.. Just beginning to get good at it, and they made me manager of the department... So back to study and thank you so much

    Jack W0KPH

Similar Threads

  1. Interrupt RPM and Taylors Elapsed time on 18F4620
    By Tobias in forum mel PIC BASIC Pro
    Replies: 70
    Last Post: - 3rd February 2010, 16:12
  2. Software PWM using Timer1
    By muqasim in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th December 2009, 11:49
  3. Timer + rc5
    By naga in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th November 2009, 07:56
  4. RC5 decode on a 10F + Question
    By ultiblade in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 11th September 2008, 08:20
  5. Serout2/serin2 Pbp Problem
    By SOMRU in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th December 2006, 19:55

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts