DT_Ints w/18F26K22 stop if incorrect baud rate


Closed Thread
Results 1 to 22 of 22

Hybrid View

  1. #1
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: DT_Ints w/18F26K22 stop if incorrect baud rate

    I just did some more testing and it seems to also halt if the baudrate is incorrect on either comm port. I placed a bit toggle inside of the timer interrupt routine, another inside of each of the Usart receive interrupt routines and ALL stop if the baudrate of the incomming data on either USART is incorrect.....
    Dave Purola,
    N8NTA
    EN82fn

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


    Did you find this post helpful? Yes | No

    Default Re: DT_Ints w/18F26K22 stop if incorrect baud rate

    Do you have the Clear Overflow Error defined?

    (DEFINE HSER_CLROERR 1)
    Charles Linquist

  3. #3
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: DT_Ints w/18F26K22 stop if incorrect baud rate

    Charles, Thanks for the reply, No I have not as I have never used the commands for HSEROUT or HSERIN to do my serial activities. I ahve always used interrupts. I used to use an old set of interrupt routines originally written by Tim Box but for the last few years I have used the DT_INT routines as they seem more stable. I have as a few of the first lines in my interrupt routine a check for the overflow bit being set. There is no interrupt for the overflow bit being set. It is up to the operator to check this bit and clear it if it is set. If it IS set there will still be an interrupt generated for the RXREG having data in it. If it IS set then after reading the data in the buffer and NOT resetting it you will NOT receive any more data into the RX shift register. The problem I am having is that ALL interrupts are comming to a halt if there is an over run. It doesn't matter which USART you are using. I have the same code working on an 18F2620 with out the second USART and have NEVER had this problem.
    Dave Purola,
    N8NTA
    EN82fn

  4. #4
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: DT_Ints w/18F26K22 stop if incorrect baud rate

    Well as it goes, I found my problem. It seemed to me to be a possible stack issue the way it was acting. Sooooo, I took another longggggg look at the interrupt routines and much to my dismay, I found a few remnants of the OLD Tim Box style syntax. He used to use a RETURN when the interrupt was to be exited. Well I found one in each of the USART interrupt routines as an early exit I used at the time before I modified them to use the DT_INT's. So it was a stack issue after all. It only goes to show, If you are going to cut and paste, Make darn sure you look at it REAL GOOD before you use it. This is the second time in a couple of years this same thing has happened to me since I switched over to the DT_INT's but, I will never go back....
    Dave Purola,
    N8NTA
    EN82fn

  5. #5
    Join Date
    Jul 2009
    Location
    Ohio, USA
    Posts
    57


    Did you find this post helpful? Yes | No

    Default Re: DT_Ints w/18F26K22 stop if incorrect baud rate

    I know this is an old thread but I am trying to get the DT_INTS to work with the 18F26k22, so far no luck with either RX1 or RX2,the program will not jump to the label in the ASM macro

    Code:
            INCLUDE "modedefs.bas"
            INCLUDE"ALLDIGITAL.pbp"
            INCLUDE "HomeAutomationVars.bas"  'Open with PBP editor
            INCLUDE "DT_INTS-18.bas"     ; Base Interrupt System
            INCLUDE "ReEnterPBP-18.bas"     ; Include if using PBP interrupts
    
        DEFINE PULSIN_MAX 1000
        DEFINE HSER_RCSTA 90h   'Hser receive status init
        DEFINE HSER_TXSTA 24h   'Hser transmit status init
        DEFINE HSER_BAUD 9600  'Hser baud rate
        DEFINE HSER_SPBRG 25
        DEFINE HSER_CLROERR 1
        DEFINE RX2_INT   PIR4,RC2IF, PIE4,RC2IE
        DEFINE TX2_INT   PIR4,TX2IF, PIE4,TXIE
        DEFINE DEBUG_REG PORTB  
        DEFINE DEBUG_BIT 0
        DEFINE DEBUG_BAUD 9600 
        ' Set Debug mode: 0 = true, 1 = inverted
        DEFINE DEBUG_MODE 1
        x var word
        
        Main:
        debug "here",cr
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler    RX_INT,    _read_serial,   PBP,  yes
            
    
       endm
        INT_CREATE             ; Creates the interrupt processor
    ENDASM    
    T0CON = %10010010 
    @   INT_ENABLE   RX_INT     ; enable external (RX) interrupts    
        
        
        for x = 1 to 1000
         pause 1
         next x
    
        Goto main
        
        
    read_serial:
    Debug "got it!!",cr    
    pause 1000
    goto main
    Is there a fuse bit that I need to set? I had no problems with an 18F1320


    Mike

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,645


    Did you find this post helpful? Yes | No

    Default Re: DT_Ints w/18F26K22 stop if incorrect baud rate

    no config section
    no define OSC
    no version of pbp



    what osc freq do you expect the chip to be running at ?

    power on default for that chip is ?

    thats an awful lot of guessing
    Warning I'm not a teacher

  7. #7
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: DT_Ints w/18F26K22 stop if incorrect baud rate

    Hi,

    A couple of things that sticks out:

    I'm fairly sure that the DEFINE HSER stuff isn't DOING anything UNTIL you actually USE a HSERIN/HSEROUT statement in your code - which you don't. Try adding a dummy HSERIN/HSEROUT - or set USART registers up yourself.

    The ISR is ending with a GOTO which is not what it's supposed to do.

    You don't want the ResetFlag option enabled since the EUSART hardware clears the flag i automatically.

    /Henrik.

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