Any Simple ASM interupt code examples out there?


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Unhappy I am confused

    Hi,

    As far as I understood that you need to monitor the serial input lines for your system to get "READY" as your qualifier. You can always do the qualifier checking manually. Looking for a "R", if found then "E" if not then again "R" and so on. Thus you (your PIC) would not be sitting inside the receive subroutine. Also the b1 variable used in your code is a BIT variable. I have no idea how a bit variable is treated in the serin ?? Also your pseudo code for the interrupt makes no sense. I thought "time" was a label but your code increments it
    Please give me a little more detail on the receiver module, a datasheet pointer perhaps and exactly what you are trying to achieve in plain english. 16F676 does not have a hardware USART. Using it saves you the headache of polling the serial pin quite often so that you don't miss a bit. But you need to use USART interrupt then.
    Regards

    Sougata

  2. #2
    Join Date
    Oct 2005
    Location
    New Zealand
    Posts
    171


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sougata View Post
    Hi,

    As far as I understood that you need to monitor the serial input lines for your system to get "READY" as your qualifier. You can always do the qualifier checking manually. Looking for a "R", if found then "E" if not then again "R" and so on. Thus you (your PIC) would not be sitting inside the receive subroutine. Also the b1 variable used in your code is a BIT variable. I have no idea how a bit variable is treated in the serin ?? Also your pseudo code for the interrupt makes no sense. I thought "time" was a label but your code increments it
    Please give me a little more detail on the receiver module, a datasheet pointer perhaps and exactly what you are trying to achieve in plain english. 16F676 does not have a hardware USART. Using it saves you the headache of polling the serial pin quite often so that you don't miss a bit. But you need to use USART interrupt then.

    How would I do the manual looking for "R", "E"... and so forth? Sorry about my pseudo code, I did it in a hurry, the lower time should read "timer" or something equiv.

    The receiver module is a linx RXM LR-418 and a link to data sheets is here: http://www.linxtechnologies.com/inde...gory=lr_series

    I'll I'm trying to do is not get the program stuck in the SERIN command when it's hearing radio static. even a timeout of 1ms hardly manages to break out of the command - very randomly and intermittantly. Am wanting to increment timer, I'll try using the TMR in the PIC for the 1st time on this project, but really need it to reliably be able to come out of the SERIN so I can switch other things - it will very seldom see a radio transmission - but when it does I need to capture it. Thanks for yr input so far

    A BIT variable seems to work ok in serin - well I haven't had any trouble with it, and it's always responded reliably.
    Last edited by George; - 28th March 2007 at 00:40.

  3. #3
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Is this what you are trying to achieve

    Hi,

    As you mentioned most of the time your radio receiver would be idle (receiving nothing). Your intention is to get out of the serial in routine when you are getting "junk" due to the random switching of the receiver output. The code I posted can just do that for you. The SERIN can jump to a label when nothing is received in the input (the input pin remains idle). So most of the time you will get "characters" due to the receiver throtlling around the noise floor. Just validate your character manually and reset your timer_counter if it is something you expect. Say you are expecting a "R". Get the character from serin first to a byte variable then check if the byte="R" and increment another pointer to check for an "E" next. If not you can let your timer_counter roll. Also you can use a 5 byte FIFO buffer to make things easy. In the FIFO you will always have the last 5 bytes received and validation becomes easier.

    You can also use the RSSI as per the datasheet to guide your PIC when to grab a data. It releives you of the software headache.

    Give the receiver side code or whatever you are transmitting. I shall try to find some time to give you an example
    Regards

    Sougata

Similar Threads

  1. decoding quadrature encoders
    By ice in forum mel PIC BASIC Pro
    Replies: 93
    Last Post: - 28th February 2017, 09:02
  2. ASM code
    By Bill Legge in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 1st March 2010, 23:55
  3. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. ASM Interrupts with BASIC code?
    By Desterline in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 31st October 2003, 19:21

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