+ Post New Thread
Page 1 of 2 1 2 LastLast
Results 1 to 20 of 22
  1. #1
    Newbie level 6
    Points: 469, Level: 4

    Join Date
    Feb 2014
    Posts
    13
    Helped
    1 / 1
    Points
    469
    Level
    4

    PIC to Pic communication Through RF module

    Hi,
    I want to get value of Temperature from temperature sensor and by using ADC of Pic I want to send it to other Pic U controller using XBee module.please tell me how to interface pic with Xbee.I need your help.
    my circuit for temperature sensor is this.
    Click image for larger version. 

Name:	Circuit.jpg 
Views:	42 
Size:	351.3 KB 
ID:	101935

  2. #2
    Full Member level 4
    Points: 1,333, Level: 8
    embRTS's Avatar
    Join Date
    Sep 2013
    Location
    Bangalore
    Posts
    216
    Helped
    36 / 36
    Points
    1,333
    Level
    8

    Re: PIC to Pic communication Through RF module

    First read the Temperature senor's value and print it in LCD ,

    Then It's kind of thing your first part is cleared ,

    Now we come at Zig-bee , Download X-CTU from Digikey Website ,
    Then take two X-Bee Modules Declare one as CoORDINATOR ""API"" & another as same as ""AT""

    Basically Check with PC only using UART to USB and check for the communication Between two X-Bee Modules

    If the Communication is successful

    So Do same with the PIC Microcontroller (interfaced with X-Bee) using UART send some data like any character 'A' and Check in the Other end's PIC microcontroller ((interfaced with ANOTHER X-Bee),
    and then if this portion is successful ,
    then Read ADC Value and send that Value using UART Tx of 1st PIC connected to X-bee only and then at the other end read that Value using ANOTHER X-bee and print that Value to 2nd LCD connected to 2nd PIC


    1 members found this post helpful.

  3. #3
    Newbie level 6
    Points: 469, Level: 4

    Join Date
    Feb 2014
    Posts
    13
    Helped
    1 / 1
    Points
    469
    Level
    4

    Re: PIC to Pic communication Through RF module

    I used Pic16f877A ucontroller and lm35 (temperature sensor). and take temperature value in proteus but on breadbord only switch on the Lcd and black square appears but output does not shoes. I used mikroC Pro for programming.

    code is given below.
    Code:
                           // Lcd pinout settings
    sbit LCD_RS at RC6_bit;
    sbit LCD_EN at RC7_bit;
    sbit LCD_D7 at RC3_bit;
    sbit LCD_D6 at RC2_bit;
    sbit LCD_D5 at RC1_bit;
    sbit LCD_D4 at RC0_bit;
    
    sbit LCD_RS_Direction at TRISC6_bit;
    sbit LCD_EN_Direction at TRISC7_bit;
    sbit LCD_D4_Direction at TRISC0_bit;
    sbit LCD_D5_Direction at TRISC1_bit;
    sbit LCD_D6_Direction at TRISC2_bit;
    sbit LCD_D7_Direction at TRISC3_bit;
    
    unsigned long ADRead;
    unsigned int vDisp[3];
    unsigned char Display[7];
    
    void main() {
    
         PORTA = 0;
         TRISA = 0X01;
         PORTC = 0;
         TRISC = 0;
         LCD_Init();
         LCD_Cmd(_LCD_CURSOR_OFF);
         LCD_Cmd(_LCD_CLEAR);
         LCD_Out(1, 1, "Temp:");
         //Display = "+125 'C";
         Display[4] = 39; //'
         Display[5]= 'C';
         ADCON1 = 0x0E;
         ADC_Init();
         while (1){
               ADRead = (ADC_Get_Sample(0) * 0.4883);     //from 500
               vDisp[0] = ADRead / 100;
               vDisp[1] = (ADRead / 10) % 10;
               vDisp[2] = ADRead % 10;
               Display[1] = vDisp[0] + 48;   // I changed 48 to 70 for checking
               Display[2] = vDisp[1] + 48;
               Display[3] = vDisp[2] + 48;
               LCD_Chr(1, 8, Display[0]);
               LCD_Chr(1, 9, Display[1]);
               LCD_Chr(1, 10, Display[2]);
               LCD_Chr(1, 11, Display[3]);
               LCD_Chr(1, 12, Display[4]);
               LCD_Chr(1, 13, Display[5]);
               //LCD_Out(1, 8, ); // 'Show temperature
               delay_ms(200); //200ms delay for waiting
         }
    }
    Last edited by alexan_e; 8th February 2014 at 16:06. Reason: added code tags



  4. #4
    Newbie level 6
    Points: 469, Level: 4

    Join Date
    Feb 2014
    Posts
    13
    Helped
    1 / 1
    Points
    469
    Level
    4

    Showing temperature on Lcd using ADC of Pic 16f877A

    hi,
    I Want to measure temperature value from LM35 temperature sensor by using ADC of PIC16f877A. I made circuit in Proteus. I used this code. It is working in Proteus but on breadboard only Lcd back light on and black squares appear but output does not shows. I used 8MHz crystal. please help me to solve this issue.
    Click image for larger version. 

Name:	Temperature.jpg 
Views:	20 
Size:	325.5 KB 
ID:	102023
    code is given below.

    Code:
                           // Lcd pinout settings
    sbit LCD_RS at RC6_bit;
    sbit LCD_EN at RC7_bit;
    sbit LCD_D7 at RC3_bit;
    sbit LCD_D6 at RC2_bit;
    sbit LCD_D5 at RC1_bit;
    sbit LCD_D4 at RC0_bit;
    
    sbit LCD_RS_Direction at TRISC6_bit;
    sbit LCD_EN_Direction at TRISC7_bit;
    sbit LCD_D4_Direction at TRISC0_bit;
    sbit LCD_D5_Direction at TRISC1_bit;
    sbit LCD_D6_Direction at TRISC2_bit;
    sbit LCD_D7_Direction at TRISC3_bit;
    
    unsigned long ADRead;
    unsigned int vDisp[3];
    unsigned char Display[7];
    
    void main() {
    
         PORTA = 0;
         TRISA = 0X01;
         PORTC = 0;
         TRISC = 0;
         LCD_Init();
         LCD_Cmd(_LCD_CURSOR_OFF);
         LCD_Cmd(_LCD_CLEAR);
         LCD_Out(1, 1, "Temp:");
         //Display = "+125 'C";
         Display[4] = 39; //'
         Display[5]= 'C';
         ADCON1 = 0x0E;
         ADC_Init();
         while (1){
              ADRead = (ADC_Get_Sample(0) * 0.4883);
               vDisp[0] = ADRead / 100;
             vDisp[1] = (ADRead / 10) % 10;
               vDisp[2] = ADRead % 10;
               Display[1] = vDisp[0] + 48;
              Display[2] = vDisp[1] + 48;
              Display[3] = vDisp[2] + 48;
               LCD_Chr(1, 8, Display[0]);
               LCD_Chr(1, 9, Display[1]);
              LCD_Chr(1, 10, Display[2]);
               LCD_Chr(1, 11, Display[3]);
               LCD_Chr(1, 12, Display[4]);
               LCD_Chr(1, 13, Display[5]);
                //LCD_Out(1, 8, ); // 'Show temperature
               delay_ms(200); //200ms delay for waiting
         }
    }



    •   AltAdvertisement

        
       

  5. #5
    Super Moderator
    Points: 29,631, Level: 41
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Brazil
    Posts
    8,862
    Helped
    1114 / 1114
    Points
    29,631
    Level
    41
    Blog Entries
    9

    Re: Showing temperature on Lcd using ADC of Pic 16f877A

    Quote Originally Posted by ranakashif View Post
    ...on breadboard only Lcd back light on and black squares appear but output does not shows...
    How are you biasing contrast adjust pin of LCD ?
    At above circuit, seems as unconnected.



    +++
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )


    1 members found this post helpful.

  6. #6
    Advanced Member level 4
    Points: 8,209, Level: 21
    Achievements:
    7 years registered
    paulfjujo's Avatar
    Join Date
    Jun 2008
    Location
    France 01120
    Posts
    1,324
    Helped
    269 / 269
    Points
    8,209
    Level
    21

    Re: Showing temperature on Lcd using ADC of Pic 16f877A

    hello

    Try to add a delay of 500mS before lcdinit
    to wait power on stabilisation..



  7. #7
    Newbie level 6
    Points: 469, Level: 4

    Join Date
    Feb 2014
    Posts
    13
    Helped
    1 / 1
    Points
    469
    Level
    4

    Re: Showing temperature on Lcd using ADC of Pic 16f877A

    I have changed the biasing of contrast adjust pin of Lcd but output does not shows. please tell me that is there any error in configuration of ADC module?



  8. #8
    Administrator
    Points: 69,512, Level: 64
    Achievements:
    Created Album pictures Created Blog entry 7 years registered
    bigdogguru's Avatar
    Join Date
    Mar 2010
    Location
    Southwest, USA
    Posts
    9,832
    Helped
    2358 / 2358
    Points
    69,512
    Level
    64
    Blog Entries
    4

    Re: Showing temperature on Lcd using ADC of Pic 16f877A

    A HD44780 based or compatible LCD display requires a proper amount of time to powerup, initialize and arrive at a known state.

    If you display resembles the following:



    It usually indicates the LCD was not allowed to powerup and initialize properly before input was received.

    Typically a 50ms delay will suffice, insert the appropriate delay routine before the LCD_Init() statement.

    How did you bias VEE?

    Typically a 10kΩ pot is utilized, with the wiper attached to VEE and the remaining terminal to VDD and VSS.

    Also, are you sure the LCD library currently being utilized supports a 4-bit interface?


    BigDog
    The Edge... there is no honest way to explain it, because the only people who really know where it is are the ones who have gone over.
    -- Hunter S. Thompson


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  9. #9
    Full Member level 1
    Points: 1,427, Level: 8
    MUKESH.K.S's Avatar
    Join Date
    Jan 2014
    Location
    KERALA
    Posts
    98
    Helped
    14 / 14
    Points
    1,427
    Level
    8

    Re: Showing temperature on Lcd using ADC of Pic 16f877A

    Connect pull up resisters on pins that connected to lcd.
    Try this code posted below it shall work


    1 members found this post helpful.

  10. #10
    Administrator
    Points: 69,512, Level: 64
    Achievements:
    Created Album pictures Created Blog entry 7 years registered
    bigdogguru's Avatar
    Join Date
    Mar 2010
    Location
    Southwest, USA
    Posts
    9,832
    Helped
    2358 / 2358
    Points
    69,512
    Level
    64
    Blog Entries
    4

    Re: Showing temperature on Lcd using ADC of Pic 16f877A

    Quote Originally Posted by MUKESH.K.S View Post
    Connect pull up resisters on pins that connected to lcd.
    The use of pull resistors is typically only necessary when the I/O pins of the microcontroller are open collector/drain.


    BigDog
    The Edge... there is no honest way to explain it, because the only people who really know where it is are the ones who have gone over.
    -- Hunter S. Thompson


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  11. #11
    Junior Member level 2
    Points: 843, Level: 6
    mjasoj's Avatar
    Join Date
    Nov 2012
    Posts
    21
    Helped
    2 / 2
    Points
    843
    Level
    6

    Re: Showing temperature on Lcd using ADC of Pic 16f877A

    Agreed with @bigdogguru
    If display resembles the image uploaded by him, it is exactly the same issue because i faced it...!


    1 members found this post helpful.

  12. #12
    Newbie level 6
    Points: 469, Level: 4

    Join Date
    Feb 2014
    Posts
    13
    Helped
    1 / 1
    Points
    469
    Level
    4

    Re: Showing temperature on Lcd using ADC of Pic 16f877A

    I have connected 4.7k resistors with four pins of ucontroller which are connected to LCD but output does not shows.


    1 members found this post helpful.

  13. #13
    Newbie level 6
    Points: 469, Level: 4

    Join Date
    Feb 2014
    Posts
    13
    Helped
    1 / 1
    Points
    469
    Level
    4

    PIC16f877A UART with XBee pro s1

    Hi,
    I want to interface XBee pro s1 with PIC16f877A.I want to transmit temperature Value through XBee pro s1 to other XBee .I used Lm35 temperature sensor and PIC16f877A. How to configure UART.please help me to solve this issue.



  14. #14
    Banned
    Points: 12,436, Level: 26

    Join Date
    Apr 2013
    Posts
    2,528
    Helped
    538 / 538
    Points
    12,436
    Level
    26

    Re: PIC16f877A UART with XBee pro s1

    Transmitter code.

    Code C - [expand]
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    
    // Lcd pinout settings
    sbit LCD_RS at RC6_bit;
    sbit LCD_EN at RC7_bit;
    sbit LCD_D7 at RC3_bit;
    sbit LCD_D6 at RC2_bit;
    sbit LCD_D5 at RC1_bit;
    sbit LCD_D4 at RC0_bit;
     
    sbit LCD_RS_Direction at TRISC6_bit;
    sbit LCD_EN_Direction at TRISC7_bit;
    sbit LCD_D4_Direction at TRISC0_bit;
    sbit LCD_D5_Direction at TRISC1_bit;
    sbit LCD_D6_Direction at TRISC2_bit;
    sbit LCD_D7_Direction at TRISC3_bit;
     
    float ADRead, oldVal = 0.0;
    unsigned char display[23];
     
    const char character[] = {6,9,9,6,0,0,0,0};
     
    void CustomChar(char pos_row, char pos_char) {
      char i;
        Lcd_Cmd(64);
        for (i = 0; i<=7; i++) Lcd_Chr_CP(character[i]);
        Lcd_Cmd(_LCD_RETURN_HOME);
        Lcd_Chr(pos_row, pos_char, 0);
    }
     
    void main() {
     
         TRISA = 0x01;
         PORTA = 0x00;
         TRISC = 0x80;
         PORTC = 0x00;
         ADCON1 = 0x0E;
     
         LCD_Init();
         LCD_Cmd(_LCD_CURSOR_OFF);
         LCD_Cmd(_LCD_CLEAR);
         LCD_Out(1, 1, "Temp: ");
     
         UART1_Init(9600);
         Delay_ms(200);
                  
         while (1){
     
              ADRead = ADC_Read(0) * 0.4883;
     
             if(oldVal != ADRead) {
        
                FloatToStr(ADRead, display);
                display[8] = '\0';
                LCD_Out(1, 7, display);
                CustomChar(1, 15);
                LCD_Out(1, 7, "C");
                strcat(display, "\r\n");
                UART1_Write_Text(display);      
                oldVal = ADRead;
              }  
                
              Delay_ms(200); 
         }
    }


    1 members found this post helpful.

  15. #15
    Full Member level 4
    Points: 1,333, Level: 8
    embRTS's Avatar
    Join Date
    Sep 2013
    Location
    Bangalore
    Posts
    216
    Helped
    36 / 36
    Points
    1,333
    Level
    8

    Re: PIC to Pic communication Through RF module

    @RanakShif :: Have you connected POT output on PIN no.3 (CONTRAST pin of LCD) Try to attach a 10k value POT and check for the BLACK Dot Matrix Appearance ,
    then it will be lowered in Contrast it may happen there that Your text is printing but due to the High Contrast it is Not Visible

    then Also Check For the R/W Pin it should be to Ground or assign to a pin which have LOW Logic in Both When it is sending Command or Data
    Try these steps and tell if you face any Problem



  16. #16
    Administrator
    Points: 69,512, Level: 64
    Achievements:
    Created Album pictures Created Blog entry 7 years registered
    bigdogguru's Avatar
    Join Date
    Mar 2010
    Location
    Southwest, USA
    Posts
    9,832
    Helped
    2358 / 2358
    Points
    69,512
    Level
    64
    Blog Entries
    4

    Re: PIC to Pic communication Through RF module

    Properly configuring the UART of the PIC16F877A depends on the system clock frequency (FOSC) of the current design.

    Also be aware some FOSC are not appropriate for generating specific baud rates, you must keep the baud rate error at or below acceptable levels.



    PIC Microcontroller RS232 I/O SPBRG Calculator

    Both the UART of the PIC and the Receiving device must match the UART settings of the XBee Pro Series 1.

    The XBee Pro Series 1 devices do not support the ZigBee protocol, they only support 802.15.4 and the proprietary DigiMesh 2.4 Protocols.

    XBee Pro Series 1 802.15.4 Documentation

    Of course, this is not an issue as the 802.15.4 protocol is fine for setting up a point-to-point virtual serial cable.

    What type of device is the other XBee Pro Series 1 connected?

    What is the current device configuration of the XBee Pro Series 1 devices, Baud Rate, etc?


    BigDog
    The Edge... there is no honest way to explain it, because the only people who really know where it is are the ones who have gone over.
    -- Hunter S. Thompson


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  17. #17
    Newbie level 6
    Points: 469, Level: 4

    Join Date
    Feb 2014
    Posts
    13
    Helped
    1 / 1
    Points
    469
    Level
    4

    Re: PIC to Pic communication Through RF module

    Hi,
    Thanks to all of u for helping me a lot.

    I have read the value from Lm35 Temperature sensor and displayed on lcd. now I want to to transmit this value to other microcontroller through XBee s1. I have bought two Xbee s1. I have checked these individually with Hyperterminal and X-CTU software. These are responding well. now I want to communicate two XBee forming a simple network with PC. After that I want to interface XBee with PIC16f877A to transmit temperature value to othe PIC because XBee works on 3.3v. How to do this?Please help me in this regard.
    The Image of XBee is given below.



  18. #18
    Banned
    Points: 12,436, Level: 26

    Join Date
    Apr 2013
    Posts
    2,528
    Helped
    538 / 538
    Points
    12,436
    Level
    26

    Re: PIC to Pic communication Through RF module

    I don't see any image attached.



  19. #19
    Newbie level 6
    Points: 469, Level: 4

    Join Date
    Feb 2014
    Posts
    13
    Helped
    1 / 1
    Points
    469
    Level
    4

    Re: PIC to Pic communication Through RF module

    Image.
    Click image for larger version. 

Name:	Drawing1.jpg 
Views:	8 
Size:	52.9 KB 
ID:	103417



  20. #20
    Newbie level 1
    Points: 143, Level: 1

    Join Date
    Aug 2013
    Posts
    1
    Helped
    0 / 0
    Points
    143
    Level
    1

    Re: PIC to Pic communication Through RF module

    I have a project where 2 xbee is used.one is connected to pc using pic18f4550 and another is is collecting adc samples send it to receiver xbee.I get the book very helpful named Building Wireless Sensor Networks by Faludi.

    To show the value of lm35 in lcd you can take look to this tutorial.
    http://millionbit.blogspot.com/2013/...r-circuit.html



--[[ ]]--