Data sending from PIC to PC
July 26, 2012 10:52PM
Hy there,

I was wondering if anyone could tell me how I could send data from the bv513 to the pc, I have an accelerometer connected to the board and I would like to see the data on my computer, but I have no idea how to do it.

To anyone that might help, thanks in advance :)
Re: Data sending from PIC to PC
July 27, 2012 05:53AM
The simplest way is to use UART2. You must have the BV513 connected to the PC anyway so use that connection. Anything you send via UART2 will go to the PC.

Example:

function to_pc()
   comouts(2,"hello pc" )
endf


Another alternative is to use UART 1 and a Bluetooth transceiver and a dongle on the PC - or send it to a phone if you know anything about Bluetooth and Android
Re: Data sending from PIC to PC
September 04, 2012 10:30PM
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
Sorry, only registered users may post in this forum.

Click here to login