void vTaskUARTTEST( void * pvParameters ){
unsigned int value1=0, value2=0, value3=0, value4=0;
AD1PCFG = 0xFFFF; // Configura los pines del puerto A como digitales. Solo para el PIC24.
asm volatile ( "MOV #OSCCON, w1 \n" "MOV #0x46, w2 \n" "MOV #0x57, w3 \n" "MOV.b w2, [w1] \n" "MOV.b w3, [w1] \n" "BCLR OSCCON,#6");
RPOR7bits.RP15R = 3; // RP15 is UART1TX
RPINR18bits.U1RXR = 14; // UART1RX is RP14
asm volatile ( "MOV #OSCCON, w1 \n" "MOV #0x46, w2 \n" "MOV #0x57, w3 \n" "MOV.b w2, [w1] \n" "MOV.b w3, [w1] \n" "BSET OSCCON, #6" );
while(1){
OpenUART1_driver( 0x8000, 0x0400, 12 );
unsigned int data = 100;
do{
WriteUART1_driver( data );
data = ReadUART1_driver();
}while( data != 100 );
CloseUART1_driver();
}
}
int main(){
if( InitUART1_driver() )
return -1;
if( pdPASS != ( xTaskCreate( vTaskUARTTEST, ( signed portCHAR * ) "UARTTEST,", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+1, &xHandleADC ) ) )
return -1;
vTaskStartScheduler();