其他声音,然后是原始.wav文件。
|
我正在使用来自微芯片v8.63的pic18F4550:我为picdem使用了C程序语言:我们创建了以下程序:我们检索了.wav文件的二进制数据,该文件转换为8bit 8000Hz(声音是:有人说\“ \” \“ red \”),我们将数据写入picdem的\'rom \'。每个值将被写入端口=>连接有一个盒子。
问题:我不能在这里显示原始声音(有人说:“红色”),而不是听到其他声音很大(没有噪音或crack啪声)但听到其他声音。
那是代码:
unsigned int b = 0;
unsigned int i = 0;
unsigned int j= 0;
#pragma romdata const_table = 0x1200
const rom char my_const_array[] = \"0b01010101
,0b10101010
,0b10101010
,0b10101010
,0b10101001
,0b01010101
,0b01010110
,0b10100101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010100
,0b10110101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01001010
,0b10101010
,0b11010101
,0b00101010
,0b10101011
,0b01010101
,0b01010101
,0b01010101
,0b01001010
,0b10101010
,0b11010100
,0b10101010
,0b10101010
,0b10110101
,0b01010101
,0b01010101
,0b01001010
,0b10101010
,0b10101010
,0b10101010
,0b10101010
,0b10101010
,0b10101101
,0b01010100
,0b10101010
,0b10011010
,0b10101010
,0b10101010
,0b10101010
,0b10101010
,0b10101010
,0b10110010
,0b10100101
,0b01010110
,0b10101010
,0b10100101
,0b01011010
,0b10101010
,0b10101010
,0b11001010
,0b10010101
,0b01011010
,0b10101001
,0b01010101
,0b01101010
,0b10101010
,0b10101101
,0b00101001
,0b01010101
,0b10101010
,0b10010101
,0b01010101
,0b10101010
,0b10101010
,0b11010010
,0b10010101
,0b01011010
,0b10101001
,0b01010101
,0b01011010
,0b10010101
,0b10101101
,0b00101001
,0b01010101
,0b10101010
,0b01010100
,0b11010101
,0b10100101
,0b01011010
,0b11001010
,0b01010101
,0b01011010
,0b10100101
,0b00101101
,0b01010101
,0b01010110
,0b10110010
,0b10010011
,0b01010110
,0b10010101
,0b00101011
,0b01010101
,0b01010101
,0b01101010
,0b01010100
,0b10101011
,0b01100101
,0b00101010
,0b10110101
,0b01010101
,0b01011010
,0b10010101
,0b00101011
,0b01010101
,0b00101010
,0b10110101
,0b01010011
,0b00110101
,0b10100100
,0b10101010
,0b11010101
,0b01001010
,0b10101010
,0b11010010
,0b10101101
,0b01100100
,0b10101010
,0b11010101
,0b01001010
,0b10101010
,0b10101010
,0b10101011
,0b01101001
,0b00101010
,0b10110101
,0b01001010
,0b10101010
,0b11001010
,0b10101011
,0b01010101
,0b00101010
,0b10101101
,0b01010010
,0b10101010
,0b10110010
,0b10101010
,0b11010101
,0b00101010
,0b10101011
,0b00101010
,0b10101010
,0b10101010
,0b10101010
,0b10110101
,0b00100101
,0b01011010
,0b10101010
,0b10010101
,0b01101010
,0b10011010
,0b10101101
,0b00100101
,0b01010110
,0b10101010
,0b10010101
,0b01010110
,0b10100101
,0b10101011
,0b01001001
,0b01010101
,0b10101010
,0b10010101
,0b01010110
,0b10100101
,0b01101010
,0b10101001
,0b01010101
,0b01101010
,0b10100101
,0b01010101
,0b01100101
,0b01010110
,0b10101010
,0b01010101
,0b01010110
,0b10010101
,0b01010101
,0b01010101
,0b01010101
,0b01101010
,0b10010101
,0b01001101
,0b01010101
,0b01001011
,0b01010101
,0b01010101
,0b01010101
,0b10100100
,0b10101010
,0b11010101
,0b01010010
,0b10101011
,0b01010100
,0b10110101
,0b01010101
,0b01001010
,0b10101011
,0b01010101
,0b00101010
,0b10101010
,0b10101010
,0b10101011
,0b01010100
,0b10101010
,0b10101010
,0b10101010
,0b10101010
,0b10101010
,0b10101010
,0b10101101
,0b01010010
,0b10100101
,0b10101010
,0b10101010
,0b01011010
,0b10101010
,0b10101010
,0b10110101
,0b01001010
,0b10010101
,0b10101010
,0b10101001
,0b01010110
,0b10101010
,0b10101010
,0b10101010
,0b10101010
,0b01010101
,0b01011010
,0b10101010
,0b10101010
,0b01010110
,0b10101010
,0b10101010
,0b10101010
,0b10101010
,0b01010101
,0b01010110
,0b10101010
,0b10101010
,0b10100101
,0b01011010
,0b10101010
,0b10101010
,0b10010101
,0b01010101
,0b10010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b01010101
,0b00000000\";
#pragma romdata
//void Delay(unsigned int);
void main (void)
{
TRISD = 0x00; // PORTD als uitgang
TRISB = 0b00110000; // RB4 en RB5 als ingang
TRISA = 0x00; // RA output
RCONbits.IPEN = 0; // prioriteit uit
INTCONbits.GIE = 1; // enable interrupt
INTCONbits.RBIE = 1; // interrupt portB aan
while(1)
{
_asm sleep _endasm
}
}
#pragma interrupt ISR
void ISR (void)
{
if (INTCONbits.RBIF==1)
{
if(PORTBbits.RB5==0)
{
TBLPTR = (short long) 0x1200;
for(i = 0 ; i<sizeof(my_const_array); i++) {
_asm TBLRDPOSTINC _endasm
LATAbits.LATA2=TABLAT;
b = 0;
do{
b++;
}while(b < 200);
}
}
}
INTCONbits.RBIF = 0;
}
没有找到相关结果
已邀请:
2 个回复
妊辽剁茧
翱抹村
只会将第一个(零)位复制到CPU引脚RA2,其余7位将丢失。