/* PIC32 Peripheral library functions and macros */ #include #include /* Configuration Bits */ #pragma config FNOSC = PRIPLL // Oscillator Selection #pragma config FPLLIDIV = DIV_2 // PLL Input Divider (PIC32 Starter Kit: use divide by 2 only) #pragma config FPLLMUL = MUL_20 // PLL Multiplier #pragma config FPLLODIV = DIV_1 // PLL Output Divider #pragma config FPBDIV = DIV_1 // Peripheral Clock divisor #pragma config FWDTEN = OFF // Watchdog Timer #pragma config WDTPS = PS1 // Watchdog Timer Postscale #pragma config FCKSM = CSDCMD // Clock Switching & Fail Safe Clock Monitor #pragma config OSCIOFNC = OFF // CLKO Enable #pragma config POSCMOD = XT // Primary Oscillator #pragma config IESO = OFF // Internal/External Switch-over #pragma config FSOSCEN = OFF // Secondary Oscillator Enable #pragma config CP = OFF // Code Protect #pragma config BWP = OFF // Boot Flash Write Protect #pragma config PWP = OFF // Program Flash Write Protect #pragma config ICESEL = ICS_PGx2 // ICE/ICD Comm Channel Select #pragma config DEBUG = OFF // Debugger Disabled for Starter Kit int main(void) { uint64_t framebuffer[128]; //Configure Timer to count to 80 at a 80Mhz Clock: 1Mhz Clock OpenTimer2(T2_ON|T2_PS_1_1|T2_IDLE_CON,80); OpenOC1(OC_ON|OC_IDLE_CON|OC_TIMER_MODE16|OC_TIMER2_SRC|OC_CONTINUE_PULSE,39,0); ConfigIntOC1(OC_INT_ON | OC_INT_PRIOR_2 ); // second timer full line // bisschen mehr für das umaddressieren hinzufügen!!!! OpenTimer3(T3_ON|T3_PS_1_1|T3_IDLE_CON,10240); OpenOC2(OC_ON|OC_IDLE_CON|OC_TIMER_MODE16|OC_TIMER3_SRC|OC_CONTINUE_PULSE,0,5119); ConfigIntOC2(OC_INT_ON | OC_INT_PRIOR_3 ); OpenOC3(OC_ON|OC_IDLE_CON|OC_TIMER_MODE16|OC_TIMER3_SRC|OC_CONTINUE_PULSE,5119,10239); OpenOC4(OC_ON|OC_IDLE_CON|OC_TIMER_MODE16|OC_TIMER3_SRC|OC_CONTINUE_PULSE,10230,10001); mPORTDSetPinsDigitalOut(BIT_8|BIT_9|BIT_10|BIT_11|BIT_12|BIT_13|BIT_14|BIT_15); mPORTDSetBits(BIT_8|BIT_9|BIT_10|BIT_11|BIT_12|BIT_13|BIT_14|BIT_15); DmaChnOpen(0, DMA_CHN_PRI1,DMA_OPEN_DEFAULT); DmaChnSetTxfer(0,&framebuffer[0],&PORTD+1,128,1,2); DmaChnSetEventControl(0,DMA_EV_START_IRQ_EN|DMA_EV_START_IRQ(INT_OC1)); DmaChnEnable(0); DmaChnForceTxfer(0); while(1); }