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 CCS Technical Support

Help PIC16F877A e RS232 and radio CAT

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








Help PIC16F877A e RS232 and radio CAT
PostPosted: Fri Feb 05, 2010 1:02 pm     Reply with quote

Basically I think that the PIC is connected to the RS232 cat radio
but did not send the command PUTS. Hello on LCD is regularly written.
Maybe it takes RS232 interrupt, or maybe not enter in the while loop?
The simulation is all ok, it works perfectly. Any suggestions?
Thanks
Jo
Code:

#include <16F877A.h>
#device adc=8
#FUSES NOWDT                    //No Watch Dog Timer
#FUSES HS                       //High speed Osc (> 4mhz)
#FUSES PUT                      //Power Up Timer
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD                    //No EE protection
#FUSES NOWRT                    //Program memory not write protected

#use delay(clock=10000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)

#include <LCD.C>
#include <string.h>
#include <stdlib.h>

char pc[6];
char pcc[6];
char pcc1[5];
char pcc2[]="PC";
int16 WATTS;
   
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
   
lcd_init();
lcd_gotoxy(5,1);
printf(lcd_putc "Hello ");
   
while(true)
  {
   puts("PC;");
   gets(pc);
   pcc[0]=pc[0];
   pcc[1]=pc[1];

   if(!strcmp(pcc,pcc2));
    {
     pcc1[0]=pc[2];
     pcc1[1]=pc[3];
     pcc1[2]=pc[4];
     pcc1[3]=0;
 
     WATTS=atol(pcc1);
     lcd_gotoxy(9,2);
     printf(lcd_putc,"%lu",WATTS);
     delay_ms(1000);
     printf(lcd_putc "\f");
    }
  }
}
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