EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / UART based interrupt not working

UART based interrupt not working

|

Microcontroller › PIC › UART based interrupt not working

  • This topic has 0 replies, 1 voice, and was last updated 10 years, 2 months ago by KOH YUEN KHANG.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • September 3, 2015 at 4:12 am #3959
    KOH YUEN KHANG
    Participant
    I'm currently interfacing pic18f4550 with a gps module(replaced by virtual terminal in proteus). But the interrupt seems not working and the data cannot be parsed. 
    I'm using Mplab IDE x8.92 with xc8 compiler.
     




    void main()
    {
    INTCON=0;
    TRISB=0;
    LATB=0;
    TRISA=0;
    LATA=0;
    TRISC=0x80;
    SPBRG=spbrg_value;
    lcd_ini();
    UART_Initilization();
    INTCONbits.GIE  = 1;              
    INTCONbits.PEIE = 1;  
     
    while(1)
    {
    while(finish!=1);
    i=0;
    lcdcmd(0x80);
    while(i<12)
    {
    lcddata(lati_data); 
    i++;
    }
     
    i=0;
    lcdcmd(0xC0);
    while(i<12)
    {
    lcddata(longi_data); 
    i++;
    }
     
    for(i=0;i<=100;i++)
    {
    __delay_ms(10);
    }
     
    lcdcmd(0x01);
    finish=0;
    }
    }
     





    void interrupt ISR()
    {
     
    if(PIR1bits.RCIF && PIE1bits.RCIE)
    {
    PIR1bits.RCIF = 0;
     
            if(RCSTAbits.OERR)       
            {               
                RCSTAbits.CREN=0; 
                RCSTAbits.CREN=1;    
            }
     
          if(finish ==0)
    {
    data=rx_data(); 
    if(data=='$')
    {
    data=rx_data();
    if(data=='G')
    {
    data=rx_data();
    if(data=='P');
    {
    data=rx_data();
    if(data=='G');
    {
    data=rx_data();
    if(data=='G')
    {
    data=rx_data();
    if(data=='A')
    {
    data=rx_data();
    if(data==',')
    {
    data=rx_data();
     
    while(data!=',')
    {
    data=rx_data();
    }
     
    for(i=0;data!='N';i++)
    {
    data=rx_data();
    lati_data=data; 
    }
    }
     
    data=rx_data();
    if(data==',')
    {
    for(i=0;data!='W';i++)
    {
    data=rx_data();
    longi_data=data; 
    }
    }
    }
    }
    }
    }
    }
    }
          }
    finish=1;
    }
    }





    Please help!
  • Author
    Posts
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • restarting this Christmas project November 14, 2025
  • desoldering November 13, 2025
  • Unknown, to me, electric motor fitting November 13, 2025
  • Can a small solar panel safely trickle-charge old NiMH AA batteries? November 13, 2025
  • KiCad custom symbol definition correct approach November 13, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise