Hello again,
Sorry for not having said anything about your answer but I didn't get it and thought it was because of my basic knowledge of.. all of this. But here I am again, since I really need to be able to send data from the bv513 to the pc.
I understand what the function you wrote is supposed to do, but how do I manage to do that? I have tried following the uart_basic example that comes in the mplabc32 folders, but I'm not getting anywhere. Using their project I just changed the baud rate to 115200 and sent a number to the uart2, hoping that something would happen. I post the code below:
#include <GenericTypeDefs.h>
#include <plib.h>
// *****************************************************************************
// *****************************************************************************
// Section: Configuration bits
// *****************************************************************************
// *****************************************************************************
#pragma config FPLLODIV = DIV_1, FPLLMUL = MUL_20, FPLLIDIV = DIV_2, FWDTEN = OFF, FCKSM = CSECME, FPBDIV = DIV_1
#pragma config OSCIOFNC = ON, POSCMOD = XT, FSOSCEN = ON, FNOSC = PRIPLL
#pragma config CP = OFF, BWP = OFF, PWP = OFF
// *****************************************************************************
// *****************************************************************************
// Section: System Macros
// *****************************************************************************
// *****************************************************************************
#define GetSystemClock() (80000000ul)
#define GetPeripheralClock() (GetSystemClock()/(1 << OSCCONbits.PBDIV))
#define GetInstructionClock() (GetSystemClock())
// *****************************************************************************
// *****************************************************************************
// Section: Function Prototypes
// *****************************************************************************
// *****************************************************************************
void SendDataBuffer(const char *buffer, UINT32 size);
UINT32 GetMenuChoice(void);
UINT32 GetDataBuffer(char *buffer, UINT32 max_size);
// *****************************************************************************
// *****************************************************************************
// Section: Constant Data
// *****************************************************************************
// *****************************************************************************
const UINT32 lineControl[] =
{
(UART_DATA_SIZE_8_BITS | UART_PARITY_NONE | UART_STOP_BITS_1),
(UART_DATA_SIZE_8_BITS | UART_PARITY_EVEN | UART_STOP_BITS_1),
(UART_DATA_SIZE_8_BITS | UART_PARITY_ODD | UART_STOP_BITS_1),
(UART_DATA_SIZE_8_BITS | UART_PARITY_NONE | UART_STOP_BITS_2),
(UART_DATA_SIZE_8_BITS | UART_PARITY_EVEN | UART_STOP_BITS_2),
(UART_DATA_SIZE_8_BITS | UART_PARITY_ODD | UART_STOP_BITS_2)
};
// *****************************************************************************
// Section: Code
// *****************************************************************************
// *****************************************************************************
// *****************************************************************************
// int main(void)
// *****************************************************************************
int main(void)
{
UINT32 menu_choice;
UINT8 buf[1024];
UARTConfigure(UART2, UART_ENABLE_PINS_TX_RX_ONLY);
UARTSetFifoMode(UART2, UART_INTERRUPT_ON_TX_NOT_FULL | UART_INTERRUPT_ON_RX_NOT_EMPTY);
UARTSetLineControl(UART2, UART_DATA_SIZE_8_BITS | UART_PARITY_NONE | UART_STOP_BITS_1);
UARTSetDataRate(UART2, GetPeripheralClock(), 115200);
UARTEnable(UART2, UART_ENABLE_FLAGS(UART_PERIPHERAL | UART_RX | UART_TX));
while(1){ if (UARTTransmitterIsReady(UART1))
{
UARTSendDataByte(UART2, 3);
}}
}
So..is it supposed to do anything? Should something come up on the BV_com screen? I would really be grateful for some guidance.
I'm sorry if I'm asking stupid or basic stuff, but I'm just getting started with PIC programming and the electronics world and I'm having a bit of a hard time here heh..
Thanks O_o