Skip to content
Permalink
Browse files
uploaded DL1416 Example Code and Library
  • Loading branch information
ab7332 committed Jun 28, 2023
1 parent 3f839b8 commit 35c29abe63fb557bcb0e64a50c19b9910983a008
Show file tree
Hide file tree
Showing 24 changed files with 828 additions and 44 deletions.
Binary file not shown.

Large diffs are not rendered by default.

@@ -0,0 +1,163 @@
#ifndef __DL1416_H // */
#define __DL1416_H // */
/*==============================================================================*/
#define c18 // Uncomment if C18 Compiler is used */
//#edfine xc8 // Uncomment if XC8 Compiler is used */
/*==============================================================================*/
#include "p18cxxx.h" // Include PIC18 related definitions */
#ifdef c18 // If C18 is used */
#include <delays.h> // Include delays library */
#endif // */
/*===== SINGLE OR MUX DISPLAY CONTROL ==========================================*/
#define DL1416_SINGLE // Uncomment if using a signle DL1416 */
//#define DL1416_MUX // Uncomment if using more than one DL1416*/
#ifdef DL1416_MUX // If multiplexed DL1416 are used define */
#define DL1416_DUAL // Uncomment if using 2x DL1416 */
//#define DL1416_TRIPPLE // Uncomment if using 3x DL1416 */
//#define DL1416_QUAD // Uncomment if using 4x DL1416 */
#endif // */
/*======DATA PIN DEFINITIONS ===================================================*/
#define DATA_PORT // PIC pins to control pin D0-D6 of DL1416*/
//#define DATA_PORTA 0 // Uncomment if PORTA is used for data */
//#define DATA_PORTB 1 // Uncomment if PORTB is used for data */
//#define DATA_PORTC 2 // Uncomment if PORTC is used for data */
#define DATA_PORTD 3 // Uncomment if PORTD is used for data */
/*====== CONTROL PIN DEFINITIONS ===============================================*/
#define CTRL_PORT // PIC pins used to control CU,CE,WR,A0,A1*/
//#define CTRL_PORTA 0 // Uncomment if PORTA is used for control */
//#define CTRL_PORTB 1 // Uncomment if PORTB is used for control */
#define CTRL_PORTC 2 // Uncomment if PORTC is used for control */
//#define CTRL_PORTD 3 // Uncomment if PORTD is used for control */
#define DL1416_D0 0 // Used to drive Data 0 pin of DL1416 */
/*==============================================================================*/
// CHARACTER SET FOR DL1416 */
//===== ROW 1 ==================================================================*/
#define DL1416_space 0b0100000 // Data for " " (space) character 0x20 */
#define DL1416_exclamation 0b0100001 // Data for "!" character is 0x21 */
#define DL1416_quote 0b0100010 // Data for '"' character is 0x22 */
#define DL1416_number_sign 0b0100011 // Data for "#" character is 0x23 */
#define DL1416_dollar_sign 0b0100100 // Data for "$" character is 0x24 */
#define DL1416_percentage 0b0100101 // Data for "%" character is 0x25 */
#define DL1416_ampersand 0b0100110 // Data for "&" character is 0x26 */
#define DL1416_apostrophe 0b0100111 // Data for "'" character is 0x27 */
//===== ROW 2 ==================================================================*/
#define DL1416_bracket_l 0b0101000 // Data for "(" character is 0x28 */
#define DL1416_bracket_r 0b0101001 // Data for ")" character is 0x29 */
#define DL1416_asterisk 0b0101010 // Data for "*" character is 0x2A */
#define DL1416_plus 0b0101011 // Data for "+" character is 0x2B */
#define DL1416_comma 0b0101100 // Data for "," character is 0x2C */
#define DL1416_minus 0b0101101 // Data for "-" character is 0x2D */
#define DL1416_full_stop 0b0101110 // Data for "." character is 0x2E */
#define DL1416_solidus 0b0101111 // Data for "/" character is 0x2F */
//===== ROW 3 ==================================================================*/
#define DL1416_digit_0 0b0110000 // Data for "0" character is 0x30 */
#define DL1416_digit_1 0b0110001 // Data for "1" character is 0x31 */
#define DL1416_digit_2 0b0110010 // Data for "2" character is 0x32 */
#define DL1416_digit_3 0b0110011 // Data for "3" character is 0x33 */
#define DL1416_digit_4 0b0110100 // Data for "4" character is 0x34 */
#define DL1416_digit_5 0b0110101 // Data for "5" character is 0x35 */
#define DL1416_digit_6 0b0110110 // Data for "6" character is 0x36 */
#define DL1416_digit_7 0b0110111 // Data for "7" character is 0x37 */
//===== ROW 4 ==================================================================*/
#define DL1416_digit_8 0b0111000 // Data for "8" character is 0x38 */
#define DL1416_digit_9 0b0111001 // Data for "9" character is 0x39 */
#define DL1416_colon 0b0111010 // Data for ":" character is 0x3A */
#define DL1416_semi_colon 0b0111011 // Data for ";" character is 0x3B */
#define DL1416_less_sign 0b0111100 // Data for "<" character is 0x3C */
#define DL1416_equals_sign 0b0111101 // Data for "=" character is 0x3D */
#define DL1416_more_sign 0b0111110 // Data for ">" character is 0x3E */
#define DL1416_qstion_mark 0b0111111 // Data for "?" character is 0x3F */
//===== ROW 5 ==================================================================*/
#define DL1416_commer_at 0b1000000 // Data for "@" character is 0x40 */
#define DL1416_A 0b1000001 // Data for "A" character is 0x41 */
#define DL1416_B 0b1000010 // Data for "B" character is 0x42 */
#define DL1416_C 0b1000011 // Data for "C" character is 0x43 */
#define DL1416_D 0b1000100 // Data for "D" character is 0x44 */
#define DL1416_E 0b1000101 // Data for "E" character is 0x45 */
#define DL1416_F 0b1000110 // Data for "F" character is 0x46 */
#define DL1416_G 0b1000111 // Data for "G" character is 0x47 */
//===== ROW 6 ==================================================================*/
#define DL1416_H 0b1001000 // Data for "H" character is 0x48 */
#define DL1416_I 0b1001001 // Data for "I" character is 0x49 */
#define DL1416_J 0b1001010 // Data for "J" character is 0x4A */
#define DL1416_K 0b1001011 // Data for "K" character is 0x4B */
#define DL1416_L 0b1001100 // Data for "L" character is 0x4C */
#define DL1416_M 0b1001101 // Data for "M" character is 0x4D */
#define DL1416_N 0b1001110 // Data for "N" character is 0x4E */
#define DL1416_O 0b1001111 // Data for "O" character is 0x4F */
//===== ROW 7 ==================================================================*/
#define DL1416_P 0b1001000 // Data for "P" character is 0x50 */
#define DL1416_Q 0b1001001 // Data for "Q" character is 0x51 */
#define DL1416_R 0b1001010 // Data for "R" character is 0x52 */
#define DL1416_S 0b1001011 // Data for "S" character is 0x53 */
#define DL1416_T 0b1001100 // Data for "T" character is 0x54 */
#define DL1416_U 0b1001101 // Data for "U" character is 0x55 */
#define DL1416_V 0b1001110 // Data for "V" character is 0x56 */
#define DL1416_W 0b1001111 // Data for "W" character is 0x57 */
//===== ROW 8 ================================================================--*/
#define DL1416_X 0b1011000 // Data for "X" character is 0x58 */
#define DL1416_Y 0b1011001 // Data for "Y" character is 0x59 */
#define DL1416_Z 0b1011010 // Data for "Z" character is 0x5A */
#define DL1416_Sqr_brkt_L 0b1011011 // Data for "[" character is 0x5B */
#define DL1416_Rvrs_solidus 0b1011100 // Data for "\" character is 0x5C */
#define DL1416_Sqr_brkt_R 0b1011101 // Data for "]" character is 0x5D */
#define DL1416_Accent 0b1011110 // Data for "^" character is 0x5E */
#define DL1416_Low_line 0b1011111 // Data for "_" character is 0x5F */
//===== DL1416 Digit Addressing ================================================*/
#define DL1416_DIG0 0 // Address for Digit 1 is 0 */
#define DL1416_DIG1 1 // Address for Digit 2 is 1 */
#define DL1416_DIG2 2 // Address for Digit 3 is 2 */
#define DL1416_DIG3 3 // Address for Digit 4 is 3 */
//===== DL1416 COMMANDS ========================================================*/
#define DL1416_CMD_SHIFT_L 0 // Command to determine Left shift */
#define DL1416_CMD_SHIFT_R 1 // Command to determine Right shift */
#define DL1416_CMD_CUR_STORE 2 // Command to store cursor position */
#define DL1416_CMD_CUR_CLEAR 3 // Command to clear cursor position */
//===== DL1416 Custom Functions ================================================*/
/* DL1416_Init */
/* Initialises the DL1416 displays */
void DL1416_Init(); // Initialisation function */
//==============================================================================*/
/* DL1416_Digit_sel */
/* Each DL1416 has four addressable digits. This function allows you to control */
/* individual digit */
void DL1416_Digit_Sel(char digit); // Function to address individual digits */
//==============================================================================*/
#ifdef DL1416_SINGLE // If only a single DL1416 is used */
/* DL1416_Print_C */
/* This function allows to load a character from the supported character set on */
/* to a specified digit of the DL1416. See above defined character set */
void DL1416_Print_C(char data, char dig_sel); // Prints char on specific digit */
//==============================================================================*/
/* DL1416_Blank_Display */
/* As the name suggest, when called, this function will turn off all 16 segments*/
/* of each digit of the DL1416 */
void DL1416_Blank_Display(); // Function to blank a DL1416 */
//==============================================================================*/
/* DL1416_Cursor_Ctrl */
/* This function can be used to save or clear the cursor position of DL1416 */
void DL1416_Cursor_Ctrl(char dig_sel, char cmd); // Function to blank a DL1416 */
#endif // */
//==============================================================================*/
#ifdef DL1416_MUX // If multiple DL1416 displays are used */
/* DL1416_Print_C */
/* This function allows to load a character from the supported character set on */
/* to a specified digit of a specified multiplexed DL1416 */
void DL1416_MUX_Print_C(char data, char dig_sel, char disp_sel); // */
//==============================================================================*/
/* DL1416_Blank_MUX_Display */
/* As the name suggest, when called, this function will turn off all 16 segments*/
/* of each digit of each multiplexed DL1416 */
void DL1416_Blank_MUX_Display(char disp_sel); // Function to blank a DL1416 */
//==============================================================================*/
/* DL1416_WriteTo_MUX_Display */
/* Looks at the defined numebr of multiplexed displays and adjusts itself to */
/* flush data onto them according to the number of digits available */
void DL1416_WriteTo_MUX_Display(char *data, char cmd); // Writes data to display*/
//==============================================================================*/
/* DL1416_MUX_Cursor_Ctrl */
/* This function can be used to save or clear the cursor position of DL1416 */
void DL1416_MUX_Cursor_Ctrl(char dig_sel, char disp_sel, char cmd); // */
//==============================================================================*/
#endif // */
#endif
Binary file not shown.
@@ -0,0 +1,46 @@
/******************************************************************************/
/* Filename: main.c */
/* Date: 14/02/2023 */
/* Version: 1.0 */
/* Authors: Svetoslav Popov */
/* Purpose: Test program for dual DL-1416 Siemens 16-segment alphanumeric */
/* displays. Two DL1416 displays, Multiplexed to be 8 digit long */
//================= PIC CONFIGURATIONS =======================================*/
#pragma config OSC = HS // External High Speed crystal selected */
#pragma config WDT = OFF // Watch-Dog Timer off */
#pragma config LVP = OFF // Low-voltage programming is off */
#pragma config MCLRE = ON // Master Clear enabled */
//================= INCLUDED LIBRARIES =======================================*/
#include <p18f4520.h> // Device used is the PICF4520 */
#include <delays.h> // C18 Delays library included */
#include "DL1416.h" // Include DL1416 library */
//============================================================================*/
char data[16] = { // */
DL1416_space,DL1416_space, // */
DL1416_space,DL1416_O, // */
DL1416_M,DL1416_E, // */
DL1416_D,DL1416_space, // */
DL1416_Y,DL1416_A, // */
DL1416_D,DL1416_space, // */
DL1416_N, DL1416_E, // */
DL1416_P, DL1416_O}; // String of chars */
//=================== MAIN FUNCTION ==========================================*/
void main() // */
{ // */
int x = 0; // For loop counter variable */
int temp = 0; // */
DL1416_Init(); // */
DL1416_WriteTo_MUX_Display(data, DL1416_CMD_SHIFT_L); // Print on DL1416s */
// */
while(1) // Infinite loop */
{ // */
temp = data[0]; // Store first array element in dummy */
for(x = 0; x < 16; x++) // Loop through data array and shift */
{ // elements to the right */
data[x] = data[x + 1]; // Assign current element with the next */
} // */
data[15] = temp; // Assign first array element to last */
// */
DL1416_WriteTo_MUX_Display(data, DL1416_CMD_SHIFT_R); //Display data */
} // */
}
Binary file not shown.

0 comments on commit 35c29ab

Please sign in to comment.