mikroC and the DLR3416
Some example code for mikroC, PIC16F73 and the 4-digit display DLR3416. /* Notes: Uses extosc @ 20Mhz. A0-A1 : RC0-RC1 (address, 1-of-4) WR : RC2 (write pulse) D0-D6 : RB0-RB6 (7 databits) LED : RC7 Inspired by Jan-Erik Söderholms asm-code for DLR3416 */ //Prototypes void toggle_wr(); //Defines #define DLR3416_A0 PORTC.F0 #define DLR3416_A1 PORTC.F1 #define DLR3416_WR PORTC.F2 #define DLR3416_DATA PORTB #define led PORTC.F7 void main() { char pos = 0; char Char = 0; //Setup TRISA = 0b11111111; TRISB = 0b0; TRISC = 0b01000000; //RC0:5,7-out, RB6-in OPTION_REG.NOT_RBPU = 0; //Set write pin DLR3416_WR = 1; //Welcome message //Char #1 //Set data DLR3416_DATA = 0b01010011; //Char 'S', see DLR3416 datasheet for character codes //Set position register pos = 0b00000011; //Set position DLR3416_A0 = pos.F0; DLR3416_A1 = pos.F1; //Toggle write pin toggle_wr(); //Char #2 //Set data DLR3416_DATA = 0b01100001; //Char 'a' //Set position register pos = 0b00000010; //Set position DLR3416_A0 = pos.F0; DLR3416_A1 = pos.F1; //Toggle write pin toggle_wr(); //Char #3 //Set data DLR3416_DATA = 0b01100001; //Char 'a' //Set position register pos = 0b00000001; //Set position DLR3416_A0 = pos.F0; DLR3416_A1 = pos.F1; //Toggle write pin toggle_wr(); //Char #4 //Set data DLR3416_DATA = 0b01100010; //Char 'b' //Set position register pos = 0b00000000; //Set position DLR3416_A0 = pos.F0; DLR3416_A1 = pos.F1; //Toggle write pin toggle_wr(); } void toggle_wr() { DLR3416_WR = 0; asm nop; DLR3416_WR = 1; asm nop; led = 0; }