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

problem when combine node B with 7 segment at node D

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



Joined: 21 Feb 2012
Posts: 9

View user's profile Send private message Send e-mail

problem when combine node B with 7 segment at node D
PostPosted: Tue Apr 10, 2012 11:40 am     Reply with quote

I use CCS CAN Bus Prototype Board.
Node B use PIC16F876A. This is my coding:
Code:

#include <16F876A.h>
#device ICD=TRUE
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#include <can-18xxx8.c>

#define WRITE_REGISTER_D_ID 0x400

void write_7_segment(int value){
   const int lcd_seg[10]={ 0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10};
   int buffer[3];
   
   buffer[0]=0x1E;
   buffer[1]=0x7F;
   buffer[2]=lcd_seg[value];
   can_putd(WRITE_REGISTER_D_ID,BUFFER, 3,1,TRUE,FALSE);
}

void main(){
   int i=0;
   
   can_init();
   can_putd(0x100,0,0,1,TRUE,FALSE);//send an on-bus message
                                    //to wake up ms\cp250x0's
                                    //wait for node c to power up
   
   delay_ms(1000);
   
   while (TRUE) {
      write_7_segment(i);
      delay_ms(1000);
      if(++i==10)
         i=0;
     
      }

  }

When I build all and compile, there is no error. But when I burn it to node B, nothing happened. Can somebody help me?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Apr 10, 2012 12:17 pm     Reply with quote

CCS provides example files for that board. I think we told you this before.
Use their example for Node B:
Quote:

c:\program files\picc\examples\ex_can_ccs_b.c

Compare the CCS file to your code. You will see that you have done
many things incorrectly. The main thing to understand is that the
16F876A is connected to an external CAN bus controller, which is the
MCP2510. The 16F876A also gets it's oscillator input from the MCP2510.
You can't just arbitrarily edit the #use delay() and change it to whatever
you want. It won't work.

Look at the CCS example file. It shows how to do it.
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