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.

[PIC] Hi, I'm using the sofware UART lib.. but the problem is that if there is no characat

Status
Not open for further replies.

medocntrl

Newbie level 2
Joined
Jun 17, 2015
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
9
I'm using the sofware UART lib.. but the problem is that if there is no characatere to be received, it still waiting in the function...
Code:
char i, error, byte_read;                 // Auxiliary variables

void main(){

  ADCON1=7;
  TRISB = 0x00;                           // Set PORTB as output (error signalization)
  PORTB = 0;                              // No error
  TRISC=0;
  PORTC=0;
  error = Soft_UART_Init(&PORTC, 7, 6, 9600, 0); // Initialize Soft UART at 14400 bps
  Soft_UART_Write('2');
  while(1) {                              // Endless loop
    byte_read = Soft_UART_Read(&error);   // Read byte, then test error flag still waiting in thise function

      Soft_UART_Write(byte_read);         // If error was not detected, return byte read
      if(byte_read=='0')PORTB = 0;
      if(byte_read=='1')PORTB = 1;
      if(byte_read=='2')PORTB = 2;
      PORTC=~PORTC;
    }
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top