12.07.2015 Views

Programming Manual Elektor Proton Robot - ELEKTOR.se

Programming Manual Elektor Proton Robot - ELEKTOR.se

Programming Manual Elektor Proton Robot - ELEKTOR.se

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The Audio module with MP3 and WAV capabilityThis demo <strong>se</strong>ts the audio module to a certain volume and instructs it to play a file called “A.MP3”. You canplace any MP3 file on a SD card and rename it A.MP3. This file will be played.PIC16F887Demoprogram Flowcode PIC V4PROTDEM_FCPIC_MP3.fcfDemoprogram Hitech C lite for PIC#include ATMEGA32Demoprogram Flowcode AVR V4PROTDEM_FCAVR_MP3.fcf_avrDemoprogram WinAVR C for AVR#include #include "PIC_PROTON_LIB.h"#define _XTAL_FREQ 19660800__CONFIG(0x2ff2); // <strong>se</strong>t HS Xtal etc__CONFIG(0x3fff);void main(){// init AD & Option regANSEL = 0;ANSELH = 0;OPTION = 0xC0;// end of init__delay_ms(250);__delay_ms(250); //wait for stable power supplyI2C_INIT(); // initialize I2C - LCD03 is a I2C LCDUART_INIT_9600();LCD03_CLEAR_SCREEN();I2C_SEND_MESSAGE(0x10,11,20); // 0 so leds nowreact to sound//20 = low <strong>se</strong>nsitivitychar String[20] = "PC V 200\0";UART_STRING_SEND( String ); // <strong>se</strong>t volume to 200(0=max - 255 = min)UART_CHAR_SEND(13); // CRchar String[20] = "PC V 30\0";UART_STRING_SEND( String ); // For some reason thisinstruction needs to be given twice..;?UART_CHAR_SEND(13); // CRchar String[20] = "PC F /A.MP3\0";UART_STRING_SEND( String ); // play file A.MP3UART_CHAR_SEND(13); // CR#define F_CPU 19660800UL#include #include "AVR_PROTON_LIB.h"#include "AVR_PROTON_LIB.c"int main ( void ){_delay_ms(250);_delay_ms(250); //wait for stable power supplyI2C_INIT(); // initialize I2C - LCD03 is a I2C LCDUART_INIT( );LCD03_CLEAR_SCREEN();I2C_SEND_MESSAGE(0x10,11,20); // 0 so leds nowreact to sound//20 = low <strong>se</strong>nsitivityUART_STRING_SEND( "PC V 200" ); // <strong>se</strong>t volume to 50(0=max - 255 = min)UART_CHAR_SEND(13); // CRUART_STRING_SEND( "PC V 30" ); // For some reasonthis instruction needs to be given twice..;?UART_CHAR_SEND(13); // CRUART_STRING_SEND( "PC F /A.MP3" ); // play fileA.MP3UART_CHAR_SEND(13); // CR}LCD03_SET_CURSOR(1);LCD03_WRITE_STRING("Playing File A.MP3");LCD03_SET_CURSOR(1);char String[20] = "Playing File A.MP3";LCD_WRITE_STRING(String);while(1){}}Bart Huyskens <strong>Manual</strong> <strong>Elektor</strong> <strong>Proton</strong> V1.0 3 April 2011 90

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!