16f877 Central Unit (page 1/2)
- page last update october 2006 - (página en castellano)
I have written the program for the microcontroller PIC 16F877 in assembly language. The source code, witch has been compiled in HEX format, can be downloaded and used freely for non commercial purposes. With the link "download" witch you can find at the bottom of this page, you can also obtain the schematics and the preliminary drawing to make the fotolito for the PCB (printed circuit board).
Circuito impreso del PIC 16F877 to MIDI
photo Holger Strauss

 

After learning with the PIC 16F84 and 16F628 I decided to carry out the final project with the PIC 16F877. This powerful microcontroller has 8 integrated ADC's (analog to digital converters) , a USART (serial port), and an electrical erasable flash memory of 8 Kbyte, sufficient for several pages of source code. (datasheet at:http://www.microchip.com)

¿Why a microcontrolador from Microchip?

  • In 1999 the Company Microchip Inc. Technology, launched the PIC 16F84. Because of its simplicity and its flash memory, this microcontroller which allows one to electronically write and erase the programme memory thousands of times, quickly became the world-wide choice in microcontrollers for educative use.
  • The chips made by Microchip have excellent backup user information, and the development tools are economical..
  • The assemble and simulation programs can be downloaded for free from Microchip.
  • Thousands of user applications can be found. One good website is: http://www.phanderson.com/ (Embedded Processor Control; Peter H. Anderson).
  • A lot of additional literature and user applications are widely available.

 

 

The panel (table 1 y tabel 2)

table 1: panel Level 0
PORTB RB,0 (16F877 pin33) audio channel - channels from 8 to 1
PORTB RB,1 (16F877 pin34) audio channel + channels from 1 to 8
PORTB RB,2 (16F877 pin35) octave - NoteValue -12 (12 semitones = 1 octave)
PORTB RB,3 (16F877 pin36) octave + NoteValue +12 (12 semitones = 1 octave)
PORTB RB,4 (16F877 pin37) note - Note -1 (smitone steps) values from 0-127
PORTB RB,5 (16F877 pin38) note + Note +1 (semitone steps) values from 0-127
PORTB RB,6 (16F877 pin39) vel - velocity -5 (0xBX -0x07 0xXX) steps of 5
PORTB RB,7 (16F877 pin40) vel + velocity +5 (0xBX -0x07 0xXX) steps of 5
 
PORTC RC,0 (16F877 pin15) MENU

configurates the Midi Channels to the 8 audio Inputs. Also in the MENU-function, RC,2 resets to initial values

PORTC RC,1 (16F877 pin16) STORE stores all momentary values.
PORTC RC,2 (16F877 pin17) NoteOff (All Note Off) sends controller message 123 (all Note OFF)
PORTC RC,3 (16F877 pin18) level panel level0 blue led; panel level1 red led
PORTC RC,4 (16F877 pin23) contr.+ slider (0xBX -0x17 0xXX) +1 (0-127)
PORTC RC,5 (16F877 pin24) contr.- slider (0xBX -0x17 0xXX) -1 (127-0)
PORTC RC,6 (16F877 pin25) prg.+ program (0xCX -0xXX) +1 (0-127)
PORTC RC,7 (16F877 pin26) prg.- program (0xCX -0xXX) -1 (127-0)
 
tabla 2: panel Level 1
PORTB RB,0 (16F877 pin33) audio channel - channels from 8 to 1
PORTB RB,1 (16F877 pin34) audio channel + channels from 1 to 8
PORTB RB,2 (16F877 pin35) bot; contr.No.0x66 OFF (0xBx -0x66 0x1E); ON (0xBx -0x66 0x69)
PORTB RB,3 (16F877 pin36) bot; contr.No.0x08 OFF (0xBx -0x08 0x1E); ON (0xBx -0x08 0x69)
PORTB RB,4 (16F877 pin37) bot; contr.No.0x69 OFF (0xBx -0x69 0x1E); ON (0xBx -0x69 0x69)
PORTB RB,5 (16F877 pin38) bot; contr.No.0x62 OFF (0xBx -0x62 0x1E); ON (0xBx -0x66 0x69)
PORTB RB,6 (16F877 pin39) contr.- (slider down) slider (0xBX -0x16 0x00) -7
PORTB RB,7 (16F877 pin40) contr.- (slider up) slider (0xBX -0x16 0x00) +7
 
PORTC RC,0 (16F877 pin15) bot; contr.No.0x06 OFF (0xBx -0x06 0x1E); ON (0xBx -0x06 0x69)
PORTC RC,1 (16F877 pin16) bot; contr.No.0x12 OFF (0xBx -0x12 0x1E); ON (0xBx -0x12 0x69)
PORTC RC,2 (16F877 pin17) mode converts analog signals to frequencies (green led)
PORTC RC,3 (16F877 pin18) level panel level 0, blue led; panel level 1, red led
PORTC RC,4 (16F877 pin23) control message + bank (0xBX -0x00 0xXX) +1 (0-127)
PORTC RC,5 (16F877 pin24) control message - bank (0xBX -0x00 0xXX) -1 (127-0)
PORTC RC,6 (16F877 pin25) program + program (0xCX -0xXX) +1 (0-127)
PORTC RC,7 (16F877 pin26) program - program (0xCX -0xXX) -1 (127-0)
 
tabla 3: initial values
Note value 0x3C (middle C) 0x90 0x3A XX
MidiCh level 0 & level 1 midi channels: 0x00
RC7, RC6 level 0 & level 1 (Programme change) prg.: 0x0C 0x00
RB6, RB7 level 0 velocity (trigger vel-, vel+) velocity: average value 0x64
RC4, RC5 panel level 0 slider 17: val 64
Buttons (6 en total) butttons: all buttons OFF (0x1E)
RC4, RC5 panel level 1 bank: 64
RB6, RB7 panel level 1 slider 16: val 64

 

next page 2/2
     
download código  HEX para el PIC 16F877 download the HEX sourcecode & the schematics etc.