PIC16F84A using pulsout and TMR0


Closed Thread
Results 1 to 33 of 33

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default

    Hi,
    I don't follow you on the math....
    If you reload TMR0 with 12 each interrupt you'll get (256-12) * 256 = 62464uS between each interrupt.

    What kind of accuracy do you need? With the prescaler set to 1:256 and a TMR0 reload value of 178 you'll get (256-178)*256 = 19968uS between each interrupt plus a little for the time it takes to reload.

    Another way would be to use an external xtal for TMR0, with a standard 32.768 watch xtal and the prescaler set to 1:128, you'll get one interrupt each second.

    MPLAB have a simulator where you can run the code, it has a stopwatch function that can be used to "measure" how long a certain piece of code takes. I've never used it myself.

    /Henrik Olsson.

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Instead of using StopWatch, you may measure it in real-world. Use a scope and measure the time using an extra I/O.

    Example:

    High AextraIO
    ' code you need to evaluate
    LOW AextraIO

    You place your scope (or frequency meter, etc etc) on the AextraIO pin and you measure it.

    something handy for your Timer Calc
    http://mister-e.org/pages/utilitiespag.html
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Nov 2006
    Posts
    33


    Did you find this post helpful? Yes | No

    Post store 365 data..

    Thanks to the advice and reply, I really appreciated it.

    From the interupt I know that I could add in the date.Such as day=day+1,month=month+1 and so on....

    I have another matter which is WHERE can i store 365 sunrsie time?
    My algoritm is just like that:-
    1 jan 2006 the sunrise time is 6:10 motor start run and 2 jan 2006 the sunrise time is 6:15 and so on.

    I know that it is impossible for me to store 365 data in the PIC16F84A eeprom.
    Can I store my data into the program memory or RAM?????

    Please advice and thanks you very much...

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    you could save it to the codespace and play around the following
    http://www.pbpgroup.com/modules/wfse...p?articleid=10

    or, use an external EEPROM.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Nov 2006
    Posts
    33


    Did you find this post helpful? Yes | No

    Post LCD question

    Hi all
    Thanks for the reply.

    Just now on the lab I have try to display the word in the LCD but NOT SUCCESS.
    Below is the code I follow all the connection on the PBP manual using PIC16F84A. LCD is bought from the www.cct.com.my.


    ‘ Set LCD Data port
    DEFINE LCD_DREG PORTA
    ‘ Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_DBIT 0
    ‘ Set LCD Register Select port
    DEFINE LCD_RSREG PORTA
    ‘ Set LCD Register Select bit
    DEFINE LCD_RSBIT 4
    ‘ Set LCD Enable port
    DEFINE LCD_EREG PORTB
    ‘ Set LCD Enable bit
    DEFINE LCD_EBIT 3
    ‘ Set LCD bus size (4 or 8 bits)
    DEFINE LCD_BITS 4
    ‘ Set number of lines on LCD
    DEFINE LCD_LINES 2
    ‘ Set command delay time in us
    DEFINE LCD_COMMANDUS 2000
    ‘ Set data delay time in us

    Pause 100 ' Wait for LCD to startup
    LCDOut $fe, 1 ' Clear LCD screen
    LCDOut "Hello" ' Display Hello

    End

    Please advice and thanks

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default

    Hi,
    Double check all connections. Do you have the pullup resistor on RA4?

    /Henrik Olsson.

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    AND never finsih your program with a single END... use a endless loop or PBP STOP.
    Code:
        LCDOUT $FE,1,"Your stuff"
    Loop:
        Goto Loop
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Pin won't stay high during Repeat...Until loop??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th August 2009, 00:57
  2. Won't go back to SLEEP after 1st Interrupt
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 29th June 2009, 10:00
  3. Battery powered applications
    By NavMicroSystems in forum Off Topic
    Replies: 7
    Last Post: - 22nd June 2009, 08:12
  4. COUNT is not counting again
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 33
    Last Post: - 19th June 2009, 05:52
  5. Can't ID interrupt source with this IntHandler??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd June 2009, 03:35

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