Who can help me checking my Programming


Closed Thread
Results 1 to 26 of 26

Hybrid View

  1. #1
    Join Date
    Jan 2008
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    now i using the voltage divider rule and the resister i will 18ohm and the test cricuit i will post at below and i got hear that D1820 that is digital temperature sensor...but i duno how to use it...i no use that before....and now how to make the sensor become stable.......

    on the pict the blue colour is my temperature sensor....
    and the resistor value is 18ohm
    and the red colour wire i connet to ADC on port A.0
    and the whole the circuit i also post at here ad...i hope u can help me....

    if really want to change the sensor D1820 the circuit how it look like and where can get it and the programe need to write again or not need...!
    Attached Images Attached Images    

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi slimpeng,
    Here! Already written, and links to where to get it. You will be here 2 years from now trying to accomplish your goal with that thermistor. Oh, and please do try to use Google, it really does work to bring you good things, like data sheets, vendors, etc. . .

    http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2815/t/al

    Code:
    @MyConfig = _HS_OSC & _WDT_ON & _PWRTE_ON & _LVP_OFF 
    @MyConfig = MyConfig & _BODEN_OFF 
    @ __config  MyConfig
    ' One-wire temperature for LAB-X1 and DS1820
    Define PIC16F877A
    @ errorlevel -230
    temperature  Var	Word			' Temperature storage
    count_remain Var    Byte	 	    ' Count remaining
    count_per_c  Var	Byte			' Count per degree C
    
    DQ	Var	PORTC.0			' One-wire data pin
    define OSC 20
    TrisA = %00000000
    TrisB = %11111111
    
    ' Define LCD registers and bits
    DEFINE LCD_DREG PORTA
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTA
    DEFINE LCD_RSBIT 5
    DEFINE LCD_EREG PORTA
    DEFINE LCD_EBIT 4
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 4
    DEFINE LCD_COMMANDUS 2000	 'Define delay time between sending LCD commands
    DEFINE LCD_DATAUS 50	     'Define delay time between data sent.
    
      CMCON  = 7
    	ADCON1 = 7			' Set PORTA and PORTE to digital
    	Low PORTE.2			' LCD R/W line low (W)
    pause 500
    LCDOUT 254,1,"initializing"
    mainloop: OWOut DQ, 1, [$CC, $44]       ' Start temperature conversion
    
    waitloop: OWIn DQ, 4, [count_remain]	' Check for still busy converting
    	If count_remain = 0 Then waitloop
    
    	OWOut DQ, 1, [$CC, $BE]		' Read the temperature
            OWIn DQ, 0, [temperature.LOWBYTE, temperature.HIGHBYTE, Skip 4, count_remain, count_per_c]
    
    	' Calculate temperature in degrees C to 2 decimal places (not valid for negative temperature)
    	temperature = (((temperature >> 1) * 100) - 25) + (((count_per_c - count_remain) * 100) / count_per_c)
    	Lcdout $fe, 1, DEC (temperature / 100), ".", DEC2 temperature, " C"
    
    	' Calculate temperature in degrees F to 2 decimal places (not valid for negative temperature)
    	temperature = (temperature */ 461) + 3200
    	Lcdout $fe, $c0, DEC (temperature / 100), ".", DEC2 temperature, " F"
    
            Pause 1000                      ' Display about once a second
    
    	Goto mainloop			' Do it forever
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by slimpeng View Post
    i will post at below and i got hear that D1820 that is digital temperature sensor...but i duno how to use it...i no use that before....and now how to make the sensor become stable.......
    if really want to change the sensor D1820 the circuit how it look like and where can get it and the programe need to write again or not need...!
    Datasheets?
    Google?
    Search the forum?

    I'm done and out...Too much time used up already...not enough legwork at the other end.
    The items referred to in Post #6 have run out.

  4. #4
    Join Date
    Jan 2008
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    last question....why the temperature going to high....oC and my LCD cant display any oC when going to low oC the LCD can display bck the value....why...! is my progrme problme...or what happen who can let me knw below is my new programe....!!!!

    help to check it


    '************************************************* ***************
    '* Name : UNTITLED.BAS *
    '* Author : [select VIEW...EDITOR OPTIONS] *
    '* Notice : Copyright (c) 2008 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 1/23/2008 *
    '* Version : 1.0 *
    '* Notes : *
    '* : *
    '************************************************* ***************
    Define LCD_DREG PORTB
    Define LCD_DBIT 4
    Define LCD_RSREG PORTB
    Define LCD_RSBIT 0
    Define LCD_EREG PORTB
    Define LCD_EBIT 1

    ' Define ADCIN parameters '

    Define ADC_BITS 8 ' Set number of bits in result
    Define ADC_CLOCK 3 ' Set clock source (3=rc)
    Define ADC_SAMPLEUS 50 ' Set sampling time in uS
    include"modedefs.bas"

    TRISB=%11111111

    pause 2
    LCDOUT 254,1,2,2,2,"WELCOME MY"
    LCDOUT 254,192,2,"MONITOR SYSTEM"

    pause 3
    LCDOUT 254,1,"MY STARTING"
    LCDOUT 254,192,2,2,2,2,2,"TEMPERATURE"

    B0 var byte ' Create TEMPERATURE to store result

    TRISC.6=0
    TRISA = %11111111 ' Set PORTA to all input
    ADCON1 =%00001010 ' Set PORTA analog
    Low PORTB.2 ' LCD R/W line low (W)

    Pause 1000

    loop:

    ADCIN 0,B0 ' Read channel 0 to adval
    Lcdout $fe, 1 ' Clear LCD
    Lcdout "Value: ",DEC B0,"'C" ' Display the decimal value
    serout portc.6,n2400,[#b0]
    Pause 5000 ' Wait .5 second

    Goto loop ' Do it forever
    End

Similar Threads

  1. Data Programming Error at 0000
    By cpatnoi in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 22nd May 2009, 03:37
  2. Problems programming
    By Lionheart in forum General
    Replies: 4
    Last Post: - 7th December 2008, 16:51
  3. PIC programming algorithm - where is it to find?
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th June 2007, 18:31
  4. Some questions for programming
    By fnovau in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2006, 16:04
  5. MELab Programming
    By tarr in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd March 2006, 13:36

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts