Interrupt & device setup for a PIC16F628A in Microcode Studio Plus


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Hi Alain.
    thanks for the reply, really cleared things up for me. I wasnt going to use timer1 to generate an interrupt but have decided to let it now. I'm using a simple repeated check on RB0 to check for a change instead of using an interrupt.

    I've attached my code, seems right to me but if anyone finds any problems or has any advice please let me know.

    Cheers
    Guy
    Attached Files Attached Files

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Hi, Picatchu

    nice code template ... easy to read !

    some tricks :

    Code:
      if (PORTB.0 = rb0old) then goto changetest ' If there is no change then test again
    change for :

    Code:
    While (PORTB.0 = rb0old)
    Wend
    this will loop till a change occurs ... ( much faster ! )

    Note here I did not understand why use the "change" feature : from your explanations ... if "back" signal detected, it simply turns PortB.0 input ON ( ... or OFF depending Hardware)

    Code:
        dummy = (time((6 * temp)+ 3300))    ' calculate part of the full calculation
    to me ( I can fail ...)
    it might be :

    Code:
        dummy = (time*((6 * temp)+ 3300))    ' calculate part of the full calculation
    By the Way : Speed of sound in air = SQR ( 13 * 287* (273.15 + Temp) /10 )

    ... @ sea level ...

    ...

    Alain

    PS: May be you could try a "samples" request here ...

    http://www.midascomponents.co.uk/
    Last edited by Acetronics2; - 3rd May 2008 at 13:47.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Hi alain.

    thanks for the "while" and maths suggestions and for the complement on my code, I will implement them. the checking for a change on RB0 is because the receiving circuit is set to be extremely sensitive and I am not sure what state the comparator, that is connected to RB0, will be in (either 0V or 5V) thats why i'm checking for a change so that regardless of what state the comparator is initially i will stop timer1 as soon as possible. if the code was this: if PORTB.0 = 1 and initially the comparator was at a high i would get an instant stop without even receiving a signal. well in my mind it makes sence :-)

    The calculation is got from one of my physics books and modified it to get rid of any decimal places and to work the distance out in one. it uses temperature in celcius rather than Kelvin.

    thanks for the link, lets see if they are willing to send overseas :-)

    Cheers and thanks again for the help!

    - Guy

Similar Threads

  1. Can't ID interrupt source with this IntHandler??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd June 2009, 02:35
  2. Microcode studio - PIC16F877A Interrupts
    By mcbeasleyjr in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 8th January 2009, 06:10
  3. CDlite to MicroCode Studio
    By grounded in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 30th January 2007, 15:46
  4. MicroCode Studio Plus ICD
    By mwhatley in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 17th August 2006, 20:55
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01:07

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