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.

How to put serial data on port B

Status
Not open for further replies.

Hasher

Junior Member level 1
Joined
Apr 14, 2009
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,458
I'm using PIC18F2420 with mikroC 8.2 with EasyPIC5 development board

I want to view the serial data I read on PORT B
I tried this code but I got nothing on it:

Code:
unsigned char i;

void main() {
   TRISB = 0;
   USART_init(19200);                     // initialize USART module
                                          //  (8 bit, 19200 baud rate, no parity bit...)
   while (1) {
     if (USART_Data_Ready()) {            // if data is received
       i = USART_Read();                  // read the received data
       USART_Write(i);                    // send data via USART
       PORTB = i;
       Delay_ms(1000);
       }
     }
}
 

The UART is hardwired to PORTC not B

That is I know very much :D
BUT
I mean I want what is sent to UART to be displayed at the same time on PORT B.
If I write '8' I want 00001000 to be displayed on PORT B.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top