Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
PORT PIN# Shared With DESC
-------------------------------------------------------------------------
RA0 19
RA1 20
RA2 30 OSCI Main Oscillator Input
RA3 31 OSCO Main Oscillator Output
RA4 34
RA5 18 MCLR Master Clear Input
RA6 7
RA7 6
RA8 32
RA9 35
RA10 12
RA11 13
RB0 21 PGEC1 ICSP Clock 1
RB1 22 PGED1 ICSP Data 1
RB2 23
RB3 24
RB4 33
RB5 41
RB6 42
RB7 43
RB8 44
RB9 1
RB10 8 SDI1 SPI1 Serial Data Input
RB11 9 SCK1 SPI1 Serial Input/Output Clock
RB12 10
RB13 11 SDO1 SPI1 Serial Data Output
RB14 14
RB15 15 SS1 SPI1 Slave Select
RC0 25 AN6 A/D Analog Input #6
RC1 26 AN7 A/D Analog Input #7
RC2 27 AN8 A/D Analog Input #8
RC3 36
RC4 37
RC5 38
RC6 2 U1RX
RC7 3 U1TX
RC8 4
RC9 5
RA0 19
RA1 20
RA4 34
RA6 7
RA7 6
RA8 32
RA9 35
RA10 12
RA11 13
RB2 23 Scan 0
RB3 24 Scan 1
RB4 33 Scan 2
RB5 41 Scan 3
RB6 42 Scan 4
RB7 43 Scan 5
RB8 44 Scan 6
RB9 1 Scan 7
RB12 10 OE1
RB14 14 OE2
RC3 36 Address A
RC4 37 Address B
RC5 38 Address C
RC6 2 UART1 RX
RC7 3 UART1 TX
RC8 4 LE1
RC9 5 LE2
gophert: Thanks for replying.
This project is only going to be generating MIDI events to feed to a synthesizer, which is a "walk in the park"
in comparison to actual waveform generation.
But I've always wanted to build a DIY synth.
Sad that those ICs are difficult to get these days.
.data
Transpose: .byte 0
Octave: .byte 0
VelCounters: .space 49, 0
LastRawScanData: .space 16, 0
RawScanData: .space 16, 0
for(i = 0;i < 16;i++)
{
LastRawScanData[i] = RawScanData[i];
}
for(i = index = 0;i < 8;i++)
{
Set the AC238 address to the lower 3 bits of 'i'.
1 or 2 tick delay...not sure. Will check the timing when the code is running.
Set the latch enables on the AC573 to low.
1 or 2 tick delay (Same as above)
Set the latch enables on the AC573 to High.
1 or 2 tick delay (Same as above)
Set the latch enable #1 on the AC573 to Low.
1 or 2 tick delay (Same as above)
RawScanData[index++] = <Port byte>;
Set the latch enable #1 on the AC573 to High.
1 or 2 tick delay (Same as above)
Set the latch enable #2 on the AC573 to Low.
1 or 2 tick delay (Same as above)
RawScanData[index++] = <Port byte>;
Set the latch enable #2 on the AC573 to High.
1 or 2 tick delay (Same as above)
}
// We now have the previous keyboard scan data as well as the current scan data.
// We can start comparing the bits and acting accordingly
// 7 bits used and only 7 out of 8 raw data registers used...
for(i = KeyIndex = 0;i < 7;i++)
{
BYTE KeyPress1 = RawScanData[i << 1],KeyPress2 = RawScanData[(i << 1) + 1];
BYTE LastKeyPress1 = LastRawScanData[i << 1],LastKeyPress2 = LastRawScanData[(i << 1) + 1];
for(j = 0;j < 7;j++)
{
// I'm going to do a bit by bit comparison. The notation I'm using here is not correct, but it illustrates the bit comparison...
if (LastKeyPress1<j> != KeyPress1<j>)
{
if (KeyPress1<j> != 0)
{
if (KeyPress2<j> == 0)
VelCounters[KeyIndex] = 0;
}
else
{
// The key has been released...
}
}
else if (KeyPress1<j> != 0 && KeyPress2<j> == 0)
VelCounters[KeyIndex]++;
else if (KeyPress1<j> != 0 && KeyPress2<j> != 0)
{
// Send a Note on to the UART buffer...
}
KeyIndex++;
}
}