DT_Interupts with 18F2525


Closed Thread
Results 1 to 7 of 7

Hybrid View

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

    Default DT_Interupts with 18F2525

    Been trying to get RX_INT to work with 18F2525, I can get it with 18F1320 but I seem to be missing something. Any help would be great...
    Here is what I have

    Code:
        
        INCLUDE "modedefs.bas"
        Include "ALLDIGITAL.pbp"
        INCLUDE "DT_INTS-18.bas"     ; Base Interrupt System
        INCLUDE "ReEnterPBP-18.bas"     ; Include if using PBP interrupts
        OSCCON =$60 'clock speed 
        DEFINE OSC 4
        
        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
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler    RX_INT,    _read_serial,   PBP,  yes
            
    
       endm
        INT_CREATE             ; Creates the interrupt processor
    ENDASM
    
    @   INT_ENABLE   RX_INT     ; enable external (RX) interrupts
    The Fuses are set as:
    __CONFIG _CONFIG1H, _OSC_INTIO67_1H
    __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
    __CONFIG _CONFIG3H, _PBADEN_OFF_3H & _MCLRE_OFF_3H
    __CONFIG _CONFIG4L, _LVP_OFF_4L & 0bfh ;_XINST_OFF_4L


    Thanks in advance

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


    Did you find this post helpful? Yes | No

    Default Re: DT_Interupts with 18F2525

    Hi,

    Have you verified that the PIC is running at the desired (4MHz) speed? OSCCON=$60 doesn't look quite right to me.
    Have you checked that the serial connection works and that you can recieve data in a non interrupt driven way, ie by using HSERIN for example?

    Not sure if it's related or nor but generaly you don't want DT-Ints to reset the interrupt flag because it gets reset automatically by the hardware when the RCREG is read.

    /Henrik.

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


    Did you find this post helpful? Yes | No

    Default Re: DT_Interupts with 18F2525

    Hi Henrik,

    The Pic is running at 4 MHz with internal xtal. I can receive serial with SERIN2, will try HSERIN.
    The ASM interrupt will not trip and go to label Read_serial:
    At work at the moment; Will confirm that I have TX and RX on the right pins when I get home and keep you updated

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


    Did you find this post helpful? Yes | No

    Default Re: DT_Interupts with 18F2525

    The Pic is running at 4 MHz with internal xtal.
    Have you actually verified that? The fact that SERIN2 works indicates that you have and it is but I must ask again because as far as I can see (looking at this datasheet setting OSCCON=$60 selects 1MHz and you don't have the PLL enabled (which only works when 4 or 8MHz is selected anyway) - if I read the datasheet correct of course.

    Then you say that the ASM interrupt won't trip, but you have the type set to PBP (and you don't show the handler).

    Anyway, make sure you can recieve using HSERIN, when that works properly go back to the interrupt driven stuff.

    EDIT: By the way, setting the baudrate and other settings using DEFINEs doesn't seem to actually do anything until you include a HSEROUT/HSERIN statement in the code. Instead of doing the DEFINE method try setting the registers directly and see if that makes any difference.

    /Henrik.
    Last edited by HenrikOlsson; - 11th January 2016 at 14:14.

  5. #5
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: DT_Interupts with 18F2525

    The problem might also be in your interrupt handler, or several other places. You should post all the code.

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: DT_Interupts with 18F2525

    could also check the serial data polarity coming to pic..... may need inverted

Similar Threads

  1. 18f2525 with LM34
    By ronjodu in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd January 2007, 04:47
  2. 18F2525 ADC Accuracy
    By mungam753 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 29th December 2005, 04:48
  3. 18F2525 Stack Pointer
    By milestag in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 23rd November 2005, 13:40
  4. 18F2525 Int Osc settings?
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th March 2005, 22:44
  5. Interrupts on 18F2525
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 26th March 2005, 02:37

Members who have read this thread : 2

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