interrupt handling faster than if's?


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Jul 2006
    Posts
    76


    Did you find this post helpful? Yes | No

    Default

    Would this work as the full code (forgive my ignorannce: I'm a newbie)?

    Transmitter:
    ------------

    define HSER_TXSTA 20h
    define HSER_BAUD 2400

    cmcon = 7

    PORTSTATE var Byte
    LASTSTATE var Byte
    input PORTA.0
    input PORTA.1
    INput PORTA.2
    input PORTA.3

    Main:
    PORTSTATE = PORTA & $0F
    If (PORTSTATE <> LASTSTATE) then
    LASTSTATE = PORTSTATE
    Hserout [PORTSTATE]
    Endif
    Pause 10
    Goto Main


    Receiver
    --------

    define HSER_CLROERR 1
    define HSER_RCSTA 90h
    define HSER_BAUD 2400

    cmcon = 7
    PortState VAR byte
    output PORTA.0
    output PORTA.1
    output PORTA.2
    output PORTA.3
    low PORTA.0
    low PORTA.1
    low PORTA.2
    low PORTA.3

    Main:
    Hserin 20,Main, [PortState]
    PortState = PortState ^ $0F
    PORTA = Portstate
    Goto Main

  2. #2
    Join Date
    Jul 2006
    Posts
    76


    Did you find this post helpful? Yes | No

    Default

    keithdoxey,

    what if I wanted to change

    "hserout [PORTSTATE]"

    to

    "hserout [WAIT("~"),PORTSTATE)"

    Would that work with the same code?

    Thank you.

    -Mike

  3. #3
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mbw123
    keithdoxey,

    what if I wanted to change

    "hserout [PORTSTATE]"

    to

    "hserout [WAIT("~"),PORTSTATE)"

    Would that work with the same code?

    Thank you.

    -Mike
    Hi Mike, sorry for the delay replying, been on holiday for a few days

    The above should be "Hserout["~",PORTSTATE]

    Wait is only applicable for Hserin.

    In your previous post, instead of all the input and output commands just use the following

    Transmitter

    TRISA = %11111111 ' all pins as inputs

    Receiver

    TRISA = %11110000 ' A3-A0 as outputs
    PORTA = 0 ' turn off all ports

    HTH

    Keith
    Keith

    www.diyha.co.uk
    www.kat5.tv

  4. #4
    Join Date
    Jul 2006
    Posts
    76


    Did you find this post helpful? Yes | No

    Default

    Thank you very much for the reply.

    "Wait is only applicable for Hserin."

    Sorry. Stupid mistake by me. I meant

    HSERIN [WAIT("~"),PORTSTATE]

    Also would that slow down the code a lot?

    Thanks.

    -Mike

Similar Threads

  1. Won't go back to SLEEP after 1st Interrupt
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 29th June 2009, 09:00
  2. 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
  3. Help with Analog Interrupt
    By brid0030 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th February 2008, 18:14
  4. NEWBIE: Some basic questions using interrupts
    By JackPollack in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th March 2006, 02:59
  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