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.

Help MikrE Pic mini 32MX534F

Status
Not open for further replies.

golad23

Newbie level 1
Joined
Jun 24, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
19
Hey good afternoon, Im just learning the PIC32 architecture for the first time and I am running to a lot of problems with the functions. I need to read received data from uart port 1 which is connected to pin rd3 and rd2 on the board which are shared with i2c and spi modules. I also need to transmit data through uart port 2 which has its own designated pin on the board. while debugging I figured that only uart port 2 was working and that uart port 1 which shared pins with other peripherals had to be declared some how in the function. i've seet the TRISD and PORTD registers to the values 0x04 for RD@ and 3 as inputs and outputs and found codes for similar devices that use
"PPSInput(2,U1RX,RD2); // Assign RPF4 as input pin for U1RX"
to declare the pins as inputs however I cant find how to do this with the device im using for uart port 1.
I need to some how designate the pins rd2 rd3 has uart port 1. Hers my code .

// GunDatatLogger
// Written November 2012
//UART1 is the input from device
//Uart2 is the monitor port - hyper term or linac service device
//RD2---->pin50------>RX
//RD3---->pin51------>TX

#include <plib.h>

void main()
{
const Insize = 80;
char StopChar[] = "\n";
char Output[Insize];

PORTD = 0x04;
TRISD = 0x04;

//PPSInput(2,U1RX,RPF4); //Assign RPF5 as input pin for U1RX
//PPSOutput(2,RPF5,U1TX); //Assign RPF4 as output pin for U1TX

UART_Set_Active(&UART1_Read, &UART1_Write, &UART1_Data_Ready, &UART1_Tx_Idle); // set UART1 active

UART1_Init(9600);
Delay_ms(1000);
UART2_Init(9600);
Delay_ms(1000);

UART2_Write(10);
UART2_Write(13);
UART2_Write_Text("MCU-Started"); // MCU present report
UART2_Write(10);
UART2_Write(13);
UART2_Write_Text("Data Log Started.");
UART2_Write(10);
UART2_Write(13);
Delay_ms(1000);


while (1)
{

if (!UART1_Data_Ready()) // Data ready bit must be set to 0 to meet condition
{
UART1_Read_Text(Output, "\0", 20);
UART2_Write_Text("1");
UART2_Write_Text(Output);

}
}
}
thank you
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top