You are on page 1of 5

MY PROJECT

PROPOSAL PIC16F876A
SCEMATIC

0x60. 0x81. 0xfe. 0x81. 0x01. 0x7e. // Here we define row values for each of the six // Alphabet. 2011. 0x81. 0x81. 0x81. 0x06. 0x42. 0x6e. 0x81. 0x7e. 0x81. 0x18. 0x81. 0x85. ' Code Protect: OFF '******************************************************************************* */ // For more space. 0x60. 0xff. 0xff. 0xff. 0x90. if/when we have a need and a bigger PIC. 0x60. ' Configuration Word: ' Oscillator: HS (8Mhz)on pins 9 and 10. // // // // // // // // // // // // // // // // // A B C D E F G H I J K L M N O P Q . 0xff. 0xff. // then we can put them back if we want. ' Test configuration: ' MCU: PIC16F876A. 0x91. 0x99. 0x7e. 0x7e. we don't need byte 0 and byte 7. ' Test. ' SW: MikroC PRO for PIC 2011 (version v4. 0x91. 0x81. ' Flash Program Write: Write Protection OFF. 0x08. 0x81. 0x7e. 0xff. 0x81. 0x01. 0x81. 0x80. 0x10. ' Data EE Read Protect: OFF. 0x4e. 0x81. 0x81. 0xff. 0x89. 0x06. 0x80. 0x88. 0x81. ' will have one second delay. 0xff. 0x91. 0x03.Board: WB-106 Breadboard 2420 dots. 0xff. 0x88. 0x81. 0x81. 0x10. 0x18. 0xff. 0x81. 0x10. the alphabet. 0x91. ' Browun Out Detect: ON. 0x88. 0x87. unsigned const short Alphabet[156]={ 0x7f. 0x7e. 0x91. 0x81. 0x00. // We have stripped them out. 0xff. ' Written by: ' Mark & ' Aureliu Raducu Macovei. 0x81.SOUCRE CODE /* '******************************************************************************* ' Project name: PIC16F876A & MAX7219 For 8x8 LED Display ' Description: ' Trough the current experiment we wish to succed the next task: ' Display on 8x8 Led matrix. 0x24. 0x91. 0x89. 0x88. columns corresponding to the 0x88. 0x10. from A through Z. 0x70. 0x7f. 0x00. The sequence between letters. ' Low Voltage Program: Disabled. 0xff. 0x89. 0x89. 0x90. 0x81.60). 0x81. 0xff. 0x81. 0x88. 0x81. 0x00. 0xff. 0x81. 0x01. ' Power up Timer: OFF. 0x91. 0xc3. ' Background Debug: Disabled. 0xff. ' Watchdog Timer: OFF. 0x7e. 0x91. 0x91. 0x10.

0x81. 0x42. 0xff. 0x42. 0xff. 0x91. 0xff. 0x90. 0x00. void max7219_init1() { Chip_Select = 0. 0x00. 0x02. 0x81. // DESELECT MAX Chip_Select = 0. 0x42. 0xfc. 0x24. 0x09. 0x02. 0x00. 0x00. 0x42. 0xc3. 0xfd. }. 0xc3. 0x00. 0x00. 0x02. 0xff. 0xfe. 0x81. 0x18. Chip_Select = 1. 0x62. 0x24. 0x00. 0x60. 0x00. 0x61. 0x3e. // SELECT MAX SPI1_write(0x09). 0x00. 0x85. 0x24. 0x3c. // End Serial 8x8 Matrix Display connections. 0x1f. 0x98. 0x62. 0x1f. // Serial 8x8 Matrix Display connections. 0x24. 0xa1. 0x81. // Here we set the configuration of max7219. 0x91. 0x00. 0x21. // SELECT MAX Chip_Select = 0. 0x20. 0x01. 0x00. 0x00. 0xff. 0xfd. 0xc0. 0x00. 0x01. }. 0x00. 0x00. 0x30. 0x00. 0x42. 0x81. 0x18. sbit Chip_Select_Direction at TRISC0_bit. 0x00. // // // // // // // // // R S T U V W X Y Z // // // // // // // // // // // // // // // // // // // ( ) [ ] { } < > / \ unsigned const short Symbols[114]={ 0x00. SPI1_write(0x0A). 0xff. 0x00. 0x3f. 0x30. 0xe7. 0xa4. 0x00. 0x20. 0xff. ! ? * # $ & % pi . SPI1_write(0x0C). 0x81. 0x24. 0x00. 0xff. 0x00. 0x42. 0x20. 0xff. 0x01. 0x24. 0x00. 0x60. 0x99. 0x66. 0x3c. Chip_Select = 1. 0xc0. 0x99. 0x48. 0x42. 0x00. 0x91. 0x00. 0x03. 0x04. // SELECT MAX Chip_Select = 0. 0x00. 0x93. 0x4e. 0x18. 0x66. 0x00. 0xfc. 0x01. 0x02. 0x00. 0x24. 0x24. 0x20. Chip_Select = 1. 0x00. // SELECT MAX // Segment luminosity intensity // DESELECT MAX // Display refresh // DESELECT MAX 0x00. 0x81. 0x94. 0x01. 0x0c. 0x00.0xff. 0xff. 0x80. 0x00. 0xe7. 0x00. 0xc3. 0x01. 0x8d. 0x00. 0x25. 0x42. 0xfe. 0x18. 0x81. SPI1_write(0x0B). 0x91. 0xff. 0x18. 0x91. 0x24. 0x00. 0xc0. 0x12. 0x98. 0x03. 0x4e. sbit Chip_Select at RC0_bit. SPI1_write(0x0F). 0x20. 0xc3. 0x91. 0x00. SPI1_write(0x07). 0x91. 0xc0. 0x18. 0x89. 0x00. 0x81. 0x04. 0xff. 0x24. // BCD mode for digit decoding SPI1_write(0x00). 0x81. 0x00. 0xc0. 0x8d. 0x0c. 0x00. 0xc0.

// Clear the display first. // We are using only columns from 2 through 7 for displaying the character.x<9. Chip_Select = 1. with an offset of 6. becouse we are using only 6 // bytes for each character. for(Column=2. SPI1_write(myColumn). becouse we are using only 6 // bytes for each character. SPI1_write(0x00). Alphabet[Start_Byte++]). // 65 represents the letter "A" in ASCII code. // Turn on the display // DESELECT MAX Chip_Select = 0. Chip_Select = 1.Column++) { Write_Byte(Column. } } void Write_Char(char myChar) { unsigned short Column. for(x=1. unsigned short myValue) { Chip_Select = 0. // deselect max7219. // Clear the display first.x++) { Write_Byte(x. with an offset of 6. Start_Byte1. Start_Byte. void Write_Byte(unsigned short myColumn. . so we will start from 65 // (look at the ascii chart). // We will use only uppercase characters.Column<8. // select max7219. // send myColumn value to max7219 (digit place). } // SELECT MAX // No test // DESELECT MAX // This is write Byte function.SPI1_write(0x01). // The next line defines our byte. // We will use only uppercase characters. Chip_Select = 1. SPI1_write(myValue). so we will start from 65 // (look at the ascii chart). SPI1_write(0xFF). void Write_Symbol(char mysymbols) { unsigned short Column1.65) * 6. // send myValue value to max7219 (digit place). from which to start the array. Clear_Matrix(). Start_Byte = (myChar . void Clear_Matrix(void) { unsigned short x. } } // This is write char function. } // This is clear matrix function.0x00).

// Clear the Matrix display. // The next line defines our byte. Delay_ms(1000). Write_Char('A'). from which to start the array. Chip_Select_Direction = 0. void main() { unsigned int x. // You can write the characters this way. between two consecutive character. /* Write_Char('R'). */ // or for(x=65. // initialize do { // infinite loop. for(Column1=2.y<=18.y. Delay_ms(1000).y++) { Write_Symbol(y). // This is our delay.Clear_Matrix().x++) { Write_Char(x). . delay_ms(500).Column1<8. // do forever. Delay_ms(1000). Start_Byte1 = (mysymbols-0) * 6 . max7219. } } // Here we have the main function. }while(1). // Set RC0 pin as output. Symbols[Start_Byte1++]).x<=90. Write_Char('U'). Delay_ms(1000). } // Increment with 1. } Clear_Matrix(). from 65 until 90. between two consecutive character. Delay_ms(1000). max7219_init1(). SPI1_init(). // Initialize SPI1 module. for(y=0.Column1++) { Write_Byte(Column1. Delay_ms(1000). Write_Char('D'). // We are using only columns from 2 through 7 for displaying the character. } // This is our delay. one at a time.