CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

GPS example

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
runo



Joined: 08 Oct 2013
Posts: 1

View user's profile Send private message

GPS example
PostPosted: Tue Oct 08, 2013 4:29 pm     Reply with quote

(GPS with pic 16f877a) how do communications ?(example for gps )
Help me please ?
Code:

#include <main.h>
#fuses XT,WDT,NOPROTECT,NOBROWNOUT,NOLVP,NOPUT,NOWRT,NODEBUG,NOCPD
#use delay (clock=4000000)
#use rs232 (baud=9600, xmit=pin_C6, rcv=pin_C7, parity=N, stop=1,ERRORS)

char klavye[50];

#int_rda
void serihaberlesme_kesmesi()
{
disable_interrupts(int_rda);

output_high(pin_d0);

gets(klavye);
delay_ms(2000);
output_low(pin_d0);
}


void main()
{
    setup_adc_ports(NO_ANALOGS);
    setup_adc(ADC_OFF);
    setup_psp(PSP_DISABLED);
    setup_spi(SPI_SS_DISABLED);
    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
    setup_timer_1(T1_DISABLED);
    setup_timer_2(T2_DISABLED,0,1);
    setup_CCP1(CCP_OFF);
    setup_CCP2(CCP_OFF);
 
    enable_interrupts(GLOBAL);
    printf("AT");
    putchar(0x0D);
 
   while(1)
    {
      enable_interrupts(int_rda);
    }
}

Why not run ?
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Tue Oct 08, 2013 7:59 pm     Reply with quote

Hi,

Frankly, your code is a mess, and we have no idea what "Why not run" means.....

A sample of issues I found on a quick scan of your code:

    1. No PIC type defined
    2. We have NO idea what's in Main.h
    3. Your serial ISR disables interrupts - not necessary
    4. Your serial ISR uses gets() - this is incorrect, it should read a SINGLE character with getc()
    5. You are repeatedly enabling int_rda in a while() loop - why???


This wheel has been invented, and re-invented many times here on the forum, so I suggest you spend a few hours reading the forum archives.....

Seriously, before you even think of a GPS project, at least get your PIC to flash an LED. Learn to crawl before you try to run!

John
TMLtech



Joined: 20 Jul 2011
Posts: 21
Location: Finland

View user's profile Send private message

PostPosted: Thu Oct 10, 2013 3:40 am     Reply with quote

And there is huge delay inside the interrupt vector.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group