Serin timeout not working properly!


Closed Thread
Results 1 to 27 of 27

Hybrid View

  1. #1
    Join Date
    Nov 2009
    Location
    London
    Posts
    251


    Did you find this post helpful? Yes | No

    Question

    Hi Bruce, it seems we jumped across each others post at the same time. I have succeeded in building the project but a warning is there.
    Code:
    Warning[206] D:\BACKUP.........TXRX.ASM 752 : Found call to macro in column 1. (INT_CREATE)
    Should I worry about it? Thanks for all the help.


    P.S. Is there any online calculator around which can easily advise me when to expect the interrupt with TMR1 with 1:8 prescaler (4MHz) and also if DT Interrupts work with TMR0 in 12F635?
    Last edited by Megahertz; - 31st December 2009 at 15:54.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Have you tried moving INT_CREATE out of column 1?

    Edit: Look for a copy of Mister Es' calculator. Should be a link in a thread around here somewhere.

    I don't think the calculator is going to help with what works & doesn't with DT ints, but Darrel already
    answered part of your question back in this thread: http://www.picbasic.co.uk/forum/showthread.php?t=12354
    Last edited by Bruce; - 31st December 2009 at 16:05. Reason: Slow down...;o}
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    Nov 2009
    Location
    London
    Posts
    251


    Did you find this post helpful? Yes | No

    Question

    Quote Originally Posted by Bruce View Post
    Have you tried moving INT_CREATE out of column 1?
    Column 1 ? What does it mean? Is it putting the ASM code somewhere in the middle of the code? Sorry for my ignorance on this topic.

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    INT_CREATE in Column 1
    Code:
    ASM
    INT_LIST  macro ; IntSource,     Label,    Type, ResetFlag?
        INT_Handler    RX_INT,  _DoIntStuff,   PBP,  yes
        endm
    INT_CREATE               ; Creates the interrupt processor
    
        INT_ENABLE   RX_INT     ; enable external UART RX interrupts  
    ENDASM
    INT_CREATE not in Column 1
    Code:
    ASM
    INT_LIST  macro ; IntSource,     Label,    Type, ResetFlag?
        INT_Handler    RX_INT,  _DoIntStuff,   PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    
        INT_ENABLE   RX_INT     ; enable external UART RX interrupts  
    ENDASM
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  5. #5
    Join Date
    Nov 2009
    Location
    London
    Posts
    251


    Did you find this post helpful? Yes | No

    Question

    Thank you Bruce. I learned something today that what a single press on the tab key can do for your code.

    You are truly a master.
    Thanks again.

  6. #6
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Megahertz View Post
    Column 1 ? What does it mean? Is it putting the ASM code somewhere in the middle of the code? Sorry for my ignorance on this topic.
    Column 1: leftmost column of each line. Asm is picky about where you put things, just start the line with several spaces.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  7. #7
    Join Date
    Nov 2009
    Location
    London
    Posts
    251


    Did you find this post helpful? Yes | No

    Question Little more help please

    Hi, I am back again with a problem. This time it looks like the interrupt is serviced but only once and code does not move forward. Can you please have a look at my code and advise me if I am doing it right ?

    Code:
    Define          OSC     4      ' OSCCON defaults to 4MHz on reset
    
    INCLUDE "DT_INTS-14.bas"     ; Base Interrupt System
    INCLUDE "ReEnterPBP.bas"     ; Include if using PBP interrupts
    Include "modedefs.bas"
    
    @ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _CP_ON & _BOD_ON & _CPD_ON & _IESO_OFF & _FCMEN_ON & _WUREN_OFF
    
    ' Pin Definations are here
    ToTx  	             var     GPIO.2     
    ToRx		var	GPIO.3
    Monitor		var  	GPIO.4
    T1CON=49
    main:
            ' Initialize the processor
            TRISIO = %011000        
            CMCON0 = 7              
            GPIO=0			       
            OPTION_REG = %00000111  
            WDA.4=1  : WPUDA.4=1
    ASM
    INT_LIST  macro    ; IntSource,    Label,  Type, ResetFlag?
           INT_Handler    TMR1_INT,  _Setval,   PBP,  yes
       endm
    	INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    start0:
    gpio.0=1 ' LED1
    
    start:
    		gpio.1=1 ' LED 2
    @   INT_ENABLE   TMR1_INT
    		Serin ToRx, N2400,["pp3"],code
    @   INT_DISABLE   TMR1_INT
                               if code=0 then goto start0
                               ' ELSE CHECK OTHER VALUES FOR THE RECEIVED CODE
    goto start0
    
    Setval:
         code=0
    	gpio.0=0 : pause 200
    @ INT_RETURN
    When power is applied this is what happens:
    1) Both LED1 & LED2 glow
    2) LED 1 (gpio.0) goes off
    and system stays like this though LED should turn ON after 200mS. Please help me know what am I doing wrong?

  8. #8
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Sounds like it's working exactly like it should be.

    1. TMR1 interrupts while it's sitting in your SERIN routine waiting for 3 ASCII characters
    followed by the byte that gets placed in code (which by the way hasn't been declared).

    2. Once the interrupt service routine executes, it returns right back to your SERIN
    routine with the LED off.

    Insert a toggle command in your int handler for a quick visual indication of the int handler
    executing. That would tell you it's working or not.

    And -as-is, it's never going to execute any code below your SERIN routine unless all 3 ASCII
    characters + the byte that goes into your undeclared code VAR are received.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  9. #9
    Join Date
    Nov 2009
    Location
    London
    Posts
    251


    Did you find this post helpful? Yes | No

    Question

    Hi Bruce, I did that and yes you are right (as always) about it. I Learnt a bit more about interrupts as well while dealing with this problem.

    Can you please advise/explain me how can I make the code jump and move to the next line of Serin with help of Interrupts. I really appreciate your help.
    Thanks


    P.S: This is not the full code, all variables are declared in my code. I just tried to highlight the problem to you with minimum code here.
    Last edited by Megahertz; - 31st December 2009 at 20:26.

Similar Threads

  1. SERIN timeout
    By Del Tapparo in forum Serial
    Replies: 3
    Last Post: - 20th November 2007, 04:34
  2. SERIN Timeout
    By George in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 23rd March 2007, 15:06
  3. 16F628A Serin timeout and Timer1
    By Rubicon in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th March 2006, 23:20
  4. SERIN SERIN2 Timeout
    By markedwards in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 23rd June 2005, 18:59
  5. SERIN & Timeout
    By BigWumpus in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th October 2004, 07:33

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