shapito
Joined: 21 Feb 2012 Posts: 9
|
problem when combine node B with 7 segment at node D |
Posted: Tue Apr 10, 2012 11:40 am |
|
|
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? |
|