Serial Interrupt


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2009
    Posts
    20

    Default Serial Interrupt

    i am looking for a way to trigger a interrupt event when i send a serial command to a pic from a pc serial port. i plan on using the serin and serout commands in the program.

  2. #2
    Join Date
    Oct 2010
    Posts
    27


    Did you find this post helpful? Yes | No

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Serial Interrupt

    Although it is possible to do what you say (if you pick your RECEIVE pin on Port B), I really wouldn't use SERIN/SEROUT. If your device has a hardware serial port - use it. Interrupts are far, far simpler that way.

    If you have no hardware serial port, and you absolutely must have an interrupt, I wrote some code 2-3 years ago that gets the job done. It might take me awhile to find it, though.

    But do you best to use the hardware first....
    Charles Linquist

  4. #4
    Join Date
    Jun 2009
    Posts
    20


    Did you find this post helpful? Yes | No

    Default Re: Serial Interrupt

    Thank you for the suggestion. By going with the hardware serial port i would need to use another chip like a max232, right? I have had pretty good luck with serin2 and serout2 in the past; I think i will give the portb interrupt a try.

  5. #5
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Serial Interrupt

    Not true

    Some chips, like the 18F2321 that I like to use for small projects, have two bits (BAUDCON.5 and BAUDCON.4) that let you invert the hardware serial port for both transmit and receive. No MAX232.
    Charles Linquist

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,802


    Did you find this post helpful? Yes | No

    Default Re: Serial Interrupt

    In this case you need to cautious as the level will not be true RS-232 but still TTL.

    Ioannis

  7. #7
    Join Date
    Jun 2009
    Posts
    20


    Did you find this post helpful? Yes | No

    Default Re: Serial Interrupt

    i was considering using a 18F2553 which does have the baudcin bits. If i set them appropriately, is it a similar hook up as shown in the pbp manual with the current limiting resistors?

  8. #8
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Serial Interrupt

    While I don't recommend the "no MAX232 approach" to anyone - certainly not for a production unit, it works. If it works on a SERIN pin, it will work on a HSERIN pin as well.

    There is only one small drawback to using the hardware in the way I mention - you can't set it for open-collector (open drain) operation without an external transistor or gate. That mode can be very useful in small networks.
    Charles Linquist

Members who have read this thread : 1

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