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] Mikro C Software UART at 3.3V internal oscillator 8mhz

Status
Not open for further replies.

lockman_akim

Advanced Member level 1
Advanced Member level 1
Joined
Jul 12, 2010
Messages
466
Helped
76
Reputation
152
Reaction score
68
Trophy points
1,308
Location
Malaysia
www.thelocxresearch.tk
Activity points
3,523
Hi,

I have a problem with my software uart, i dont receive any data at my computer after transmitting via soft uart. is that the problem cause by the unstable internal oscillator? here my code written using mikro c.

Code:
char input[4];
char celcius[4];
char error,byte_read;
unsigned int raw_celcius;
int ad_val;
float ph;
char some_byte = 0x31;

void main()
{
    UART1_Init(38400);
    OSCCON.F6 = 1;
    OSCCON.F5 = 1;
    OSCCON.F4 = 1;
    ADCON0 = 0b00000001;
    ADCON1.F7 = 1;
    ANSEL = 0b11111111;
    TRISD = 0;
    PORTD = 0;
    
    UART1_Write_Text("LO");
    UART1_Write(13);
    PORTD = 255;
    Delay_ms(500);

    UART1_Write_Text("L1");
    UART1_Write(13);
    PORTD = 255;
    Delay_ms(500);
    
    error = Soft_UART_Init(&PORTC, 5, 4, 9600, 0);
     
    do
    {

     if (error == 0)
     {
      PORTD = 255;
      Soft_UART_Write(some_byte);
      delay_ms(100);
      PORTD = 0;
      delay_ms(100);
      error = Soft_UART_Init(&PORTC, 5, 4, 9600, 0);
     }
     else if (error > 0)
     {
      PORTD = 0;
     }
     
    }
    while(1);
}
 

im using pic16f887
mikro c version 6.0

i dont have any problem with hardware uart, hardware uart is connected to the sensor.
software uart is connected to xbee. yes i already configure xbee and it manage to communicate each other.
but when i plug xbee to my board, no data was received.

i try to directly used usb to uart converter and the data showed on my pc.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top