caramoan tour package

caramoan tour package

Author Topic: future project:3310LCD+PIC+LM35(or LM34)  (Read 17937 times)

Offline RaffT

  • Technical People
  • Hydroelectric
  • *****
  • Posts: 3440
  • Pogi/Ganda Points: 103
  • Gender: Male
  • more on R-n-D
    • MY Bots
future project:3310LCD+PIC+LM35(or LM34)
« on: August 20, 2008, 11:54:52 AM »
mga sirs 

 ideas pls... medyo "ayaw work utak ko" ngayun...  ??? ::)

what to do with read_adc(); para maconvert yung mV reading from the temp sensor ICs?
I have read from another topic na may "hardware connection" sa analog ports etc etc...yung +Vref etc etc....

nagawan ko na ito ng code(im using 877 sa proteus/CCS C) yung maka basa sa ADC port pero..limited pa knowledge ko dito regarding setting up the ADC... wala ba samples/suggestions? ;D

Learning is CooL! BEAM robotics/DIY UCD180/PSP/AC wtmtr/digiESRmtr/PICkit™2 clone/SGTC/SSTC/DR-SSTC

Never argue with an idiot... They'll take you down to their level and beat you with experience

Philippine Electronics Forum

future project:3310LCD+PIC+LM35(or LM34)
« on: August 20, 2008, 11:54:52 AM »

Offline glutnix_neo

  • Technical People
  • Nuclear Reactor
  • *****
  • Posts: 4180
  • Pogi/Ganda Points: 166
  • Gender: Female
  • 1 Corinthians 11:14
    • Underground Workbench
Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #1 on: August 20, 2008, 12:31:19 PM »
Medyo mababa yata ang output ng LM35, kailangan mo iamplify para at least magequal to 5V yung "maximum temp" na kaya nya mabasa(Because your ADC reference, which I assumed, is equal to your Vcc which is 5V if you set it that way).

This way mamamaximize ang resolution ng ADC.

When setting up the ADC naman, nasa help file yun ng CCS

setup_adc_ports( ALL_ANALOG );        //check mo C:\Program Files\PICC\Devices\16F877.h ADC Functions:
                                                     //for supported parameters
setup_adc(ADC_CLOCK_INTERNAL );
set_adc_channel( 0 );                        //select the channel to read
value = read_adc();                           //store the value
setup_adc( ADC_OFF );                      //optional, used to conserve power when ADC is not used

mas maganda kung ang gamiting mong +Vref eh yung Vcc mo na at -Vref eh yung ground.

If we hear,we forget;if we see, we remember;if we do,we understand.
Let's support the use of free and open source softwares...
http://UndergroundWorkbench.wordpress.com

Philippine Electronics Forum

Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #1 on: August 20, 2008, 12:31:19 PM »

Offline RaffT

  • Technical People
  • Hydroelectric
  • *****
  • Posts: 3440
  • Pogi/Ganda Points: 103
  • Gender: Male
  • more on R-n-D
    • MY Bots
Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #2 on: August 20, 2008, 12:59:03 PM »
mas maganda kung ang gamiting mong +Vref eh yung Vcc mo na at -Vref eh yung ground.

ito ba yung sa PIC analog ports?

cge try ko modify code ko mamaya.. :)
Learning is CooL! BEAM robotics/DIY UCD180/PSP/AC wtmtr/digiESRmtr/PICkit™2 clone/SGTC/SSTC/DR-SSTC

Never argue with an idiot... They'll take you down to their level and beat you with experience

Philippine Electronics Forum

Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #2 on: August 20, 2008, 12:59:03 PM »

Offline glutnix_neo

  • Technical People
  • Nuclear Reactor
  • *****
  • Posts: 4180
  • Pogi/Ganda Points: 166
  • Gender: Female
  • 1 Corinthians 11:14
    • Underground Workbench
Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #3 on: August 20, 2008, 01:02:44 PM »
yup yan nga yun, BTW yung mga values sa #defines ng .h file eh same din sa makikita mo sa datasheet.
If we hear,we forget;if we see, we remember;if we do,we understand.
Let's support the use of free and open source softwares...
http://UndergroundWorkbench.wordpress.com

Philippine Electronics Forum

Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #3 on: August 20, 2008, 01:02:44 PM »

Offline RaffT

  • Technical People
  • Hydroelectric
  • *****
  • Posts: 3440
  • Pogi/Ganda Points: 103
  • Gender: Male
  • more on R-n-D
    • MY Bots
Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #4 on: August 20, 2008, 01:08:34 PM »
may nahanap ulit ako.. hehe

http://www.pages.drexel.edu/~cy56/PIC.htm

Learning is CooL! BEAM robotics/DIY UCD180/PSP/AC wtmtr/digiESRmtr/PICkit™2 clone/SGTC/SSTC/DR-SSTC

Never argue with an idiot... They'll take you down to their level and beat you with experience

Philippine Electronics Forum

Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #4 on: August 20, 2008, 01:08:34 PM »

Offline RaffT

  • Technical People
  • Hydroelectric
  • *****
  • Posts: 3440
  • Pogi/Ganda Points: 103
  • Gender: Male
  • more on R-n-D
    • MY Bots
Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #5 on: August 20, 2008, 01:29:30 PM »
YES!! nagawa ko rin.. hehe post ko mamaya simulation ko sa proteus...

eto yung CODE sa mga gusto mag try

Code: [Select]
   #include <16F877.h>
   #device ADC=10
   #fuses HS,NOWDT,NOPROTECT
   #use delay(clock=10000000)
   //=========setup port for F877=====================================
   #byte lcdport         = 0x06   // portA=05h B=06h C=07h D=08h E=09h
   #byte lcdport_tris   = 0x86   // trisA=85h B=86h C=87h D=88h E=89h
   
   #bit nok_sclk = lcdport.5    //pin2 LCD  portX5
   #bit nok_sda  = lcdport.6    //pin3 LCD  portX6
   #bit nok_dc   = lcdport.7    //pin4 LCD  portX7
   #bit nok_cs   = lcdport.0    //pin5 LCD  portX0
   #bit nok_res  = lcdport.1    //pin8 LCD  portX1
   //============================================================
   #include "3310.c"

   int16 value,value1;

void init();




void main()
   {
      init();
     
      setup_adc(ADC_CLOCK_INTERNAL);
      setup_adc_ports(AN0_AN1_AN3);
      set_adc_channel(0);

      while(true)
         {
         delay_ms(1);
         value=read_adc();
         value1=5.00 * value * 100.00/1023.00;

         nokia_gotoxy(1,1);
         printf(nokia_printchar,"adc RAW:%ld",value);
   
         nokia_gotoxy(1,2);       
         printf(nokia_printchar," deg C:%f",(float)value1);
     
         //nokia_gotoxy(1,3);       
         //printf(nokia_printchar," deg F : %ld",degf);
     
         }
   }



void init()
   {
   
   lcdport_tris = 0x00;        // lcdport all bits are outputs
   port_b_pullups(TRUE);
   nokia_init();
   }






note: di pa yan optimized... napagana palang using 3310 LCD...
Learning is CooL! BEAM robotics/DIY UCD180/PSP/AC wtmtr/digiESRmtr/PICkit™2 clone/SGTC/SSTC/DR-SSTC

Never argue with an idiot... They'll take you down to their level and beat you with experience

Offline RaffT

  • Technical People
  • Hydroelectric
  • *****
  • Posts: 3440
  • Pogi/Ganda Points: 103
  • Gender: Male
  • more on R-n-D
    • MY Bots
Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #6 on: August 20, 2008, 01:36:10 PM »
eto:

Learning is CooL! BEAM robotics/DIY UCD180/PSP/AC wtmtr/digiESRmtr/PICkit™2 clone/SGTC/SSTC/DR-SSTC

Never argue with an idiot... They'll take you down to their level and beat you with experience

Offline RaffT

  • Technical People
  • Hydroelectric
  • *****
  • Posts: 3440
  • Pogi/Ganda Points: 103
  • Gender: Male
  • more on R-n-D
    • MY Bots
Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #7 on: August 20, 2008, 01:39:15 PM »

 ooopppsss ..wala siya negative values.. pero ADC WILL NOT accept negative values.. pano kaya ito???

 anyways, ok na rin itong toy room temp.. or pang READ ng temperature sa kilikili.. hehe addo-on nalang ng STORE VALUE (for reading) or freeze the current reading to be viewed, then after a few secs, read na ulit... more room for experimentations :)
Learning is CooL! BEAM robotics/DIY UCD180/PSP/AC wtmtr/digiESRmtr/PICkit™2 clone/SGTC/SSTC/DR-SSTC

Never argue with an idiot... They'll take you down to their level and beat you with experience

Offline Cute_Worm_1983

  • Size D Battery
  • ******
  • Posts: 418
  • Pogi/Ganda Points: 16
  • Gender: Male
Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #8 on: August 20, 2008, 01:39:36 PM »
^ mukhang may bago ka project ngayon?  ;D
I love electronicslab.ph

Offline RaffT

  • Technical People
  • Hydroelectric
  • *****
  • Posts: 3440
  • Pogi/Ganda Points: 103
  • Gender: Male
  • more on R-n-D
    • MY Bots
Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #9 on: August 20, 2008, 01:43:56 PM »
^ hehehe nasa PC palang.. ewan if i-actual ko nga yan... wala akong soic dito(maliban sa F876).. may F88 naman ako dito pero PDIP..  basta yun.. gumana rin hhehe :)

parang kagaya din ito sa nakita kong Temp sensor using DS*** ata yun... eto yung "pinoy version" hehe
Learning is CooL! BEAM robotics/DIY UCD180/PSP/AC wtmtr/digiESRmtr/PICkit™2 clone/SGTC/SSTC/DR-SSTC

Never argue with an idiot... They'll take you down to their level and beat you with experience

Offline glutnix_neo

  • Technical People
  • Nuclear Reactor
  • *****
  • Posts: 4180
  • Pogi/Ganda Points: 166
  • Gender: Female
  • 1 Corinthians 11:14
    • Underground Workbench
Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #10 on: August 20, 2008, 01:44:10 PM »
ooopppsss ..wala siya negative values.. pero ADC WILL NOT accept negative values.. pano kaya ito???

 anyways, ok na rin itong toy room temp.. or pang READ ng temperature sa kilikili.. hehe addo-on nalang ng STORE VALUE (for reading) or freeze the current reading to be viewed, then after a few secs, read na ulit... more room for experimentations :)

add ka ng offset in such a way na yung minimum negative input mo eh equal to zero pagdating sa ADC pin, to do this you may use a summing amplifier or other techniques.
If we hear,we forget;if we see, we remember;if we do,we understand.
Let's support the use of free and open source softwares...
http://UndergroundWorkbench.wordpress.com

Offline RaffT

  • Technical People
  • Hydroelectric
  • *****
  • Posts: 3440
  • Pogi/Ganda Points: 103
  • Gender: Male
  • more on R-n-D
    • MY Bots
Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #11 on: August 20, 2008, 01:46:22 PM »
di kaya masira if "panipisin" ko pa yung LM35DZ (TO92) para MAS mabilis ang reading?? medyo may kamahalan kasi ito eh.. hehehe tig P120 yung isa...
Learning is CooL! BEAM robotics/DIY UCD180/PSP/AC wtmtr/digiESRmtr/PICkit™2 clone/SGTC/SSTC/DR-SSTC

Never argue with an idiot... They'll take you down to their level and beat you with experience

Offline RaffT

  • Technical People
  • Hydroelectric
  • *****
  • Posts: 3440
  • Pogi/Ganda Points: 103
  • Gender: Male
  • more on R-n-D
    • MY Bots
Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #12 on: August 20, 2008, 01:48:35 PM »
add ka ng offset in such a way na yung minimum negative input mo eh equal to zero pagdating sa ADC pin, to do this you may use a summing amplifier or other techniques.

may ginawa na ako nyan dati using op-amp(para sa scope input section ng YUScope 3530) :) input range was -5V to +5V (output 0V->5V)....

pero ok na rin ito sa room temp.. di naman tayo nasa North pole ;D ...
Learning is CooL! BEAM robotics/DIY UCD180/PSP/AC wtmtr/digiESRmtr/PICkit™2 clone/SGTC/SSTC/DR-SSTC

Never argue with an idiot... They'll take you down to their level and beat you with experience

Offline glutnix_neo

  • Technical People
  • Nuclear Reactor
  • *****
  • Posts: 4180
  • Pogi/Ganda Points: 166
  • Gender: Female
  • 1 Corinthians 11:14
    • Underground Workbench
Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #13 on: August 20, 2008, 01:49:52 PM »
pwede mo rin gamitin yung -Vref, supplayan mo ng reference na equal to minimum negative value, but again pag nabasa ng ADC to 0 - 2^nbits rin ang values. mas complicated pa
If we hear,we forget;if we see, we remember;if we do,we understand.
Let's support the use of free and open source softwares...
http://UndergroundWorkbench.wordpress.com

Offline RaffT

  • Technical People
  • Hydroelectric
  • *****
  • Posts: 3440
  • Pogi/Ganda Points: 103
  • Gender: Male
  • more on R-n-D
    • MY Bots
Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #14 on: August 20, 2008, 01:51:39 PM »
^hmmm reading your response, sounds "complicated" na to me.. hehehehe sige lang, pag may time, pag aaralan ko pa maagi how to use the ADC port of PIC... :)
Learning is CooL! BEAM robotics/DIY UCD180/PSP/AC wtmtr/digiESRmtr/PICkit™2 clone/SGTC/SSTC/DR-SSTC

Never argue with an idiot... They'll take you down to their level and beat you with experience

Offline paranz

  • Moderator
  • Nuclear Reactor
  • *****
  • Posts: 4525
  • Pogi/Ganda Points: 177
  • Gender: Male
  • 1/4W resistor specialist
    • RapidSignal Electronics
Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #15 on: August 20, 2008, 05:01:30 PM »
try this..

LM35 connected to RA1/ANA1, and +1V connected to VREF+ pin (RA3).

3310 LCD connected at PORTB by default.

The program will display the 10-bit value and the equivalent temperature value. Values updated every 1 second.

Code: [Select]

#include <16F877.h>

//config bits
#FUSES NOWDT                     //No Watch Dog Timer
#FUSES HS                        //High speed Osc (> 4mhz)
#FUSES NOPUT                     //No Power Up Timer
#FUSES PROTECT                   //Code protected from reads
#FUSES NOBROWNOUT                //No brownout reset
#FUSES NOLVP                     //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD                     //No EE protection
#FUSES NOWRT                     //Program memory not write protected
#FUSES NODEBUG                   //No Debug mode for ICD

//10-bit adc output
#device adc=10

#use delay(clock=20000000)
#byte lcdport   = 0x06   // PORTB

#include "3310_ccs.c"                 //3310 files here!

void main()
{
    unsigned long adc_val;
    char adc_val_string[10];
    float temp_val;
    char temp_val_string[10];
 
    set_tris_b(0x00);
    setup_adc_ports(AN0_AN1_VSS_VREF);         
    setup_adc(ADC_CLOCK_DIV_32);                   


    //LM35 connected to RA1/AN1
    set_adc_channel(1);         
    delay_us(50);
   
    nokia_init();
   
    while(1)
    {
        nokia_clean_ddram();                        //clear lcd screen
        adc_val =  read_adc();                      //read adc
       
        //display 10-bit adc
        nokia_gotoxy(2,1);
        printf(nokia_printchar, "ADC value:");       
        sprintf(adc_val_string, "%Lu" , adc_val);
        nokia_gotoxy(4,2);
        printf(nokia_printchar, adc_val_string);
       
        //display calculated temperature value
        temp_val = (adc_val / 1024.0) * 100.0; 
        nokia_gotoxy(2,3);
        printf(nokia_printchar, "Temperature:");
        sprintf(temp_val_string, "%0.2f" , temp_val);
        nokia_gotoxy(4,4);
        printf(nokia_printchar, temp_val_string);
        printf(nokia_printchar, " deg.");
       
        delay_ms(1000);
    }
}



PIC16 Programming Tutorial using MPLAB and Hi-Tech C
www.rapidsignalph.com/tutorials/pic16-tutorials

Arduino & gizDuino Tutorials
www.rapidsignalph.com/tutorials/arduino-tutorials

Offline paranz

  • Moderator
  • Nuclear Reactor
  • *****
  • Posts: 4525
  • Pogi/Ganda Points: 177
  • Gender: Male
  • 1/4W resistor specialist
    • RapidSignal Electronics
Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #16 on: August 20, 2008, 05:12:05 PM »
ito pala ang screenshot:





PIC16 Programming Tutorial using MPLAB and Hi-Tech C
www.rapidsignalph.com/tutorials/pic16-tutorials

Arduino & gizDuino Tutorials
www.rapidsignalph.com/tutorials/arduino-tutorials

Offline glutnix_neo

  • Technical People
  • Nuclear Reactor
  • *****
  • Posts: 4180
  • Pogi/Ganda Points: 166
  • Gender: Female
  • 1 Corinthians 11:14
    • Underground Workbench
Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #17 on: August 21, 2008, 08:04:08 AM »
mga masters, yung library na "3310_ccs.c" saan nyo nakuha?
If we hear,we forget;if we see, we remember;if we do,we understand.
Let's support the use of free and open source softwares...
http://UndergroundWorkbench.wordpress.com

Offline Cute_Worm_1983

  • Size D Battery
  • ******
  • Posts: 418
  • Pogi/Ganda Points: 16
  • Gender: Male
I love electronicslab.ph

Offline RaffT

  • Technical People
  • Hydroelectric
  • *****
  • Posts: 3440
  • Pogi/Ganda Points: 103
  • Gender: Male
  • more on R-n-D
    • MY Bots
Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #19 on: August 21, 2008, 08:43:12 AM »
sir choy paranz,

 tnx sa input... hehe cge mapag aralan ulit... pogi point for you :)
Learning is CooL! BEAM robotics/DIY UCD180/PSP/AC wtmtr/digiESRmtr/PICkit™2 clone/SGTC/SSTC/DR-SSTC

Never argue with an idiot... They'll take you down to their level and beat you with experience

Philippine Electronics Forum

Re: future project:3310LCD+PIC+LM35(or LM34)
« Reply #19 on: August 21, 2008, 08:43:12 AM »

 

Privacy Policy

Contact Us: elabph@yahoo.com