Embedded Systems and Power Electronics

Total Pageviews

About Me

My photo
I am currently a PhD student at UC Berkeley, following a 6-year journey working at Apple after my undergrad years at Cornell University. I grew up in Dhaka, Bangladesh where my interest in electronics was cultivated, resulting in the creation of this blog.

BTemplates.com

Powered by Blogger.

Mar 28, 2012

15 comments:

  1. Hi, first i want to thank u a lot for your explantion in "MODALITIES OF USING THE ADC", very good. If i write this this message it's just to know if u can make another one in the use of CCP MODULE or INTERRUPTION MODULE OF PIC 16F877A thanks.

    ReplyDelete
  2. Thank u for nice explanation of ADC.My fundamentals are clear now.Request to give same tutorial for CCP module to make frequency measurement.Regards & thanks once again.
    Vinay Parmar.
    Baroda-Gujarat.
    email:goldendollar@rediffmail.com

    ReplyDelete
  3. Good Afternoon Tahmid, im currently doing a project in wireless data logger in sending temp and humid to pc via bluetooth. Having problem in the early stages of the coding itself. Here is the coding :


    //port definition
    //input
    #define SW1 PORTB.F0
    #define SW2 PORTB.F1
    //output
    //LED
    #define LED1 PORTB.F6
    #define LED2 PORTB.F7

    // LCD module connections
    sbit LCD_RS at RB4_bit;
    sbit LCD_EN at RB5_bit;
    sbit LCD_D0 at RD0_bit;
    sbit LCD_D1 at RD1_bit;
    sbit LCD_D2 at RD2_bit;
    sbit LCD_D3 at RD3_bit;
    sbit LCD_D4 at RD4_bit;
    sbit LCD_D5 at RD5_bit;
    sbit LCD_D6 at RD6_bit;
    sbit LCD_D7 at RD7_bit;

    sbit LCD_RS_Direction at TRISB4_bit;
    sbit LCD_EN_Direction at TRISB5_bit;
    sbit LCD_D0_Direction at TRISD0_bit;
    sbit LCD_D1_Direction at TRISD1_bit;
    sbit LCD_D2_Direction at TRISD2_bit;
    sbit LCD_D3_Direction at TRISD3_bit;
    sbit LCD_D4_Direction at TRISD4_bit;
    sbit LCD_D5_Direction at TRISD5_bit;
    sbit LCD_D6_Direction at TRISD6_bit;
    sbit LCD_D7_Direction at TRISD7_bit;
    // End LCD module connections

    char value[7];
    char value2[7];
    void introduction(void);
    void initialization(void);
    void stat_mode(void);
    void main()
    {
    initialization();
    introduction();
    while(1)
    {
    unsigned char i;
    unsigned portvalue;
    unsigned portvalue2;
    portvalue=Adc_Read(0);
    portvalue2=Adc_Read(1);
    portvalue= portvalue/2;
    portvalue2=(portvalue2/2);
    WordToStr(portvalue, value);
    WordToStr(portvalue2,value2);
    Lcd_Out(1,1,"TEMP. CEL:");
    Lcd_Out(1,12,value);
    Lcd_Out(1,16,"C");
    Lcd_Out(2,1,"HUMI. RH :");
    Lcd_Out(2,12,value2);
    Lcd_Out(2,16,"%");
    delay_ms(1000);
    for(i=0;i<13;i++)
    {
    Uart1_Write(value[i]);
    //Usart_Write('\n');
    //Usart_Write(value2[i]);
    }
    Uart1_Write('\n');
    for(i=0;i<13;i++)
    {
    //Usart_Write(value[i]);
    //Usart_Write('\n');
    Uart1_Write(value2[i]);
    }
    } }
    void initialization(void)
    {
    PORTA = 0; // Clear Port
    PORTB = 0;
    TRISA=0b11111111;
    TRISB=0b00000000;
    TRISD=0;
    ADCON1=0;
    ADC_Init();
    Lcd_Init();
    Lcd_Cmd(_LCD_CLEAR);
    Lcd_Cmd(_LCD_CURSOR_OFF);
    delay_ms(150);
    Uart1_Init(9600);
    }
    void introduction()
    {
    unsigned char i;
    Lcd_Cmd(_LCD_CLEAR);
    Lcd_Out(1,1,"WELCOME");
    Delay_ms(2000);
    Lcd_Cmd(_LCD_CLEAR);
    Lcd_Out(1,1," WIRELESS ");
    Lcd_Out(2,1," DATALOGGER ");
    delay_ms(2000);
    for(i=0; i<16; i++) { // Move text to the left 16 times
    Lcd_Cmd(_LCD_SHIFT_LEFT);
    delay_ms(80);
    }
    Lcd_Cmd(_LCD_CLEAR);
    }

    At first in the beginning , the LCD will be showing black boxes and once reset button is pressed on the SK40C , the LCD will function as according to the coding but at the temperature and humidity reading showing some readings of random number as the sensor is not even connected to the RA0 and RA1. Im using LM35 , Cytron Humidity Sensor , SK40C and PIC16F877A. Need help in this.

    ReplyDelete
  4. Could anyone please send me ""MODALITIES OF USING THE ADC" written by Tahmid.
    I cannot download it, my net connection is very slow.
    Pls send it to
    drhamidbd@yahoo.com

    - Regards

    Muhammad Riazul Hamid
    Dhaka

    ReplyDelete
    Replies
    1. I have posted the direct download link on the article. Here it is again:

      http://www.4shared.com/office/573V1o6z/Modalities_of_using_the_ADC_mo.html

      If your internet is slow and downloading the file from the above link is slow, then, it won't be faster if someone emails it to you. So, just download it from the above link. If it takes time, consider downloading it when you won't be using your computer for a long time at a stretch and just let it finish downloading.

      Regards,
      Tahmid.

      Delete
  5. Thanks Tahmid. You have a rare talent of explaining practical things. I've got a great pleasure reading your blogpost about ADC in pics.

    ReplyDelete
  6. Hi, your book is great, but I have one question about Vref+ and Vref-, in Datasheet of PIC16F877A in Table 7-14 (A20) minimum voltage difference between Vref+, and Vref- is 2V. But in your book on page 5 is 1,5V ("Thus, our reference voltage is (3.5-2.0) = 1.5V"). Could you explane this?.

    ReplyDelete
  7. Hi! Thanks for this tutorial it's very intresting.. i need your help can you contact me at mail ? my email is :
    dantonalexandre1996@gmail.com
    It's for my project at school and i have to use the CAN bus.

    ReplyDelete
  8. Hi,

    This tutorial is best ever so far available on internet,do you have any tutorial like this for interfacing external higher bit ADC with PIC16F877??

    ReplyDelete
    Replies
    1. I do not! I haven't had the need to use an ADC with higher resolution. Is there any specific ADC you have in mind?

      Delete
    2. Actually i want to measure -0.7V to +0.7V and at the same time corresponding current (upto 3A).(basically a volt and current meter).and if possible take this real time data to the PC.for this i like to use one external ADC part number is MCP3421.if you kindly help me in this regards i will be very thank full to you.

      And one more request to you, can you please make this type of tutorial (Modalities of Using the ADC module of PIC16F877A) for Interuppt,TIMER and PWM generation by giving some real time application example.

      Than You
      hemghosh04@gmail.com

      Delete
  9. really thanks for posting Modalities Of Using The ADC Module Of PIC 16F877A..i want ur help for i^2c bus....pls help me
    rk771990@gmail.com

    ReplyDelete
  10. actually i m a newbie to pic16f877a...i searched lot of materials in net..but really ur explanation seems to be excellent..pls explain i^c in ur way,,so that it wil be helpful for alll,,,,,,,sorry for disturbing u....

    ReplyDelete
  11. Hi,
    I need a closed loop pgm for controlling my dc-dc converter.I am using PIC16F877Aand my duty ratio is 0.5.Output voltage is varying from 18-28V.Desired voltage is 20V.

    ReplyDelete
  12. everything is clear. Nothing has been left. Thanks again Thamid

    ReplyDelete