I've been given a PIC32mx795f512L in order to build a spy for I2C, I will connect 3 wires on SDA, SCL and GND and then I have to detect the sent data. This part is ok. Now, once I have the data, I have to send it via RX, TX to a computer (in fact, I send it to an adapter which convert it to RS232) and here is my problem.
I do not really know how to initialise this communication. For now I put:
mPORTFClearBits(BIT_8);
TRISFbits.TRISF8=0; // RF8 output==>TX1
TRISFbits.TRISF2=1; // RF1 input==>RX1
U1STA = 0x1400; // Enable Tx(inv) and Rx
U1BRG = 8332; // value = (80000000 / BAUD) - 1 = 9600
U1MODE = 0x8008; // Enable UART with 1 stop bit, no parity and BRGH
OpenUART1(UART_EN | UART_BRGH_FOUR, UART_RX_ENABLE | UART_TX_ENABLE, UBRG(UART1_BAUD));
By checking the data sheet but I actually don't know if everything needed is set up. And nonetheless, I don't get how to send data via TX. I've found this topic where it says:
To make some char output (a - into this example) on the UART simply write this code:
if(!BusyUART1()) putsUART1("-\r\n"); "
But I can't find where "a" is used.
So please, If someone feels able to help me, feel free to do it.