Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Receiving data to PIC controller from terminal

Status
Not open for further replies.

jai patel

Newbie level 3
Joined
Mar 18, 2014
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
26
Hello

I am try to receiving sequence of fixed length by below function. so, can anyone say that what I have to pass in below function at the place of Output.

Code:
/******************************************************************************/
/* Read data from UART                                                       */
/*****************************************************************************/
char UART_Read() {

    while (!RCIF);
    return RCREG;
}

void UART_Read_Text(char *Output, unsigned int length) {
    int i;
    for (int i = 0; i < length; i++)
        Output[i] = UART_Read();
}

I am using PIC16F887 and hi tech c compiler with MPLAB X IDE.
 

you need to initialize a pointer variable or an array outside the function UART_read_Text() and than pass it to your function.

after the function is executed your pointer will point to data that is received by function.
 

you need to initialize a pointer variable or an array outside the function UART_read_Text() and than pass it to your function.

after the function is executed your pointer will point to data that is received by function.

ok I have initialised it but what should I have to pass at the place of *output in function.
 

hello


you don't need to pass anything to the function.just calling that function without any arguments,

define the length of the string in outside the main fun...
 

Also you need to initialize ur char pointer with some string so that it initializes some memory nd no other variable takes in a memory in between it..
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top