Magnifico
Joined: 23 Oct 2019 Posts: 3
|
Embedded C Dev Kit |
Posted: Wed Oct 23, 2019 9:31 am |
|
|
I am working through the examples/lessons and during lesson 7 i am not able to get the 7 segment display to light up. I am not seeing any errors when i build/compile and run the program.
Code: |
/* ccscana.c */
#include <18f45k80.h>
#device ICD=TRUE
#fuses NOPROTECT,NOWDT
#use delay(clock=64MHz,crystal=16MHz)
#define CAN_BRG_PRESCALAR 15
#define CAN_BRG_PHASE_SEGMENT_1 6
#define CAN_BRG_PHASE_SEGMENT_2 6
#define CAN_BRG_PROPOGATION_TIME 0
#define CAN_BRG_SYNCH_JUMP_WIDTH 0
#include <can-18F4580.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);
}
/* ex6.c */
#include "ccscana.c"
void main(void){
int i=0;
can_init();
can_putd(0x100,0,0,1,TRUE,FALSE); //send an on-bus message
//to wake up MCP250x0's
delay_ms(1000); //wait for node c to power-up
while(true){
write_7_segment(i);
delay_ms(1000);
if(++i==10)
i=0;
}
} |
|
|