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

18F25K80 CANbus problem

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



Joined: 24 Aug 2012
Posts: 9

View user's profile Send private message MSN Messenger

18F25K80 CANbus problem
PostPosted: Fri Aug 24, 2012 10:14 am     Reply with quote

hello

I am using standard can-18xxx8.c and can-18xxx8.h files to use CanBus system. But my IC which is 18F25K80 cant send data or receive. I looked by oscilloscope, RX-TX are working very well.

I think I have to find file for 18F25K80 or related family.
Code:

#include "18F25K80.h"

#device adc=12

//#fuses HSH,CANB,PROTECT,NOWDT,NOFCMEN,NOCPB,NOPUT,NOBROWNOUT,NOPLLEN,CANB

#fuses HSH,NOPLLEN,NOFCMEN,BROWNOUT,BORV27,NOWDT,PUT,NOCPD,STVREN,NODEBUG,NOWRT,NOWRTD,NOIESO,NOEBTR,NOEBTRB,MCLR,PROTECT,NOCPB,NOWRTB,NOWRTC,NOXINST,SOSC_DIG,CANB   // próba

#use delay(clock=20M)


void main()
{
unsigned int32 rx_id;

   int last_lcd_output=0xFF;
   int curr_lcd_output;
   
   setup_wdt(WDT_OFF);
   setup_comparator(NC_NC_NC_NC);
      setup_adc_ports(NO_ANALOGS);
      setup_adc(ADC_OFF);
      setup_vref(FALSE);
      //setup_psp(PSP_DISABLED);
      setup_ccp1(CCP_OFF);   // Configure CCP1 as a PWM
      setup_ccp2(CCP_OFF);   // Configure CCP2 as a PWM
      setup_ccp3(CCP_OFF);   // Configure CCP2 as a PWM
      setup_ccp4(CCP_OFF);   // Configure CCP2 as a PWM
      setup_ccp5(CCP_OFF);   // Configure CCP2 as a PWM
      can_init();
// can_set_mode(CAN_OP_LOOPBACK);
     
//unsigned int16 i;
setup_timer_1(T1_INTERNAL | T1_DIV_BY_1);
enable_interrupts(INT_TIMER1);
enable_interrupts(GLOBAL);

DATA_SURE_YAZARKEN_BEKLEME=0;
SAYAC_500_MIKRO=0;

MINO_CONTROL_DEMO();

YAZMA_BEKLEME_SAYACI=0;
 IKAZ();
 MINO_EX_IN_DATA_IKINCISI[0]=0;
 MINO_EX_IN_DATA_IKINCISI[1]=0;
 MINO_EX_IN[0]=0;
 MINO_EX_IN[1]=0;
 DATA_ESKIME_SAYACI=0;

for(;;)
{
DEVICE_ID_SPECIFY();

CAN_BUS_KAT_BILGISI_GONDER();

   if ( can_kbhit() )
 {DATA_ALAMAMA_SAYACI=0; // hata sayacını daha aldığında 0 la
         if(can_getd(rx_id, buffer, rx_len, rxstat))
         { 
            if (rx_id == DEVICE_ID) {
     
     if(CRC_CONTROL(buffer[0],buffer[1],buffer[2])==1&&buffer[3]==235)
       {   MINO_OUT[0]=buffer[1];
          MINO_OUT[1]=buffer[0];
          MINO_OKU_YAZ();
       
       }

            }
           
          if (rx_id == INDICATOR_KNOWLEDGE)
          {
          GOSTERGE_BYTE_CIKIS=buffer[0];
          AYUK_CIK_TYUK_CIK_MESGUL_KAPA_AC_YED1_YED2_YED_3=buffer[1];
          SERI_DATA_OLUSTUR();
          }
           
           
            }
     
           }
           
           
    else{DATA_ALAMAZSA_RESETLE();
   
    }
 
  }

}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Aug 24, 2012 4:11 pm     Reply with quote

Quote:

I am using standard can-18xxx8.c and can-18xxx8.h files to use CanBus
system. But my IC which is 18F25K80 cant send data or receive. I looked
by oscilloscope, RX-TX are working very well.

I think I have to find file for 18F25K80 or related family.



The CAN bus driver for the 18F4580 would be more accurate for your PIC:
    c:\program files\picc\drivers\can-18F4580.c
    c:\program files\picc\drivers\can-18F4580.h
turhan



Joined: 24 Aug 2012
Posts: 9

View user's profile Send private message MSN Messenger

PostPosted: Mon Aug 27, 2012 10:23 am     Reply with quote

i tried it , still problem is going
otaggart



Joined: 24 Aug 2012
Posts: 4
Location: Canada

View user's profile Send private message Visit poster's website

PostPosted: Tue Aug 28, 2012 3:12 pm     Reply with quote

Hi,

What compiler version are you using? I ask because I am also having a CAN bus problem, but mine is even less far along than yours (no signal visible on TX pin at all and PIC freezes when I attempt to enter loopback mode). Like you, I have also tried switching to the new driver with no success.
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