LN(natural log)


Results 1 to 8 of 8

Thread: LN(natural log)

Threaded View

  1. #6
    rpstroj's Avatar
    rpstroj Guest


    Did you find this post helpful? Yes | No

    Default

    Code:
    INCLUDE "modedefs.bas"               'Contains mode definitions for
    
    DEFINE OSC 12                   ' Define OSC 12Mhz for HS
    
    DEFINE ADC_BITS        8
    DEFINE ADC_CLOCK    3
    DEFINE ADC_SAMPLEUS    50
    
    TRISA = %11111111
    TRISB = %00000000
    
    ADCON1=3
    
      
    'Variables for LCD
    clrSCR CON 12     ' Cntl-L: clear the display.
    posCmd CON 16     ' Position the cursor.
    ESC    CON 27        ' Escape code.
    noCurs CON 4    ' no cursor shown
    
    Q0 VAR BYTE
    adcount VAR BYTE
    adjust VAR BYTE
    LCD VAR PORTB.0
    
    Pause 500
    
          SerOut2 LCD, 16468, [clrSCR]             'Clear LCD and cursor to upper left      
    Pause 500    
        
    High PORTB.2
    
    Loop:
    
    ADCON0=%11000001
    PauseUs 50
    ADCON0.2 = 1  'start conversion
    PauseUs 50
    adcount=ADRES
    
          'ADCIN 0, adcount
          adjust=adcount-1
          LookUp adjust,[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,6,7,8,9,10,10,11,12,12,13,14,14,15,16,16,17,18,18,19,20,20,21,21,22,22,23,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,32,32,33,33,34,34,35,35,36,36,37,37,37,38,38,39,39,40,40,41,41,41,42,42,43,43,44,44,44,45,45,46,46,47,47,47,48,48,49,49,50,50,50,51,51,52,52,52,53,53,54,54,55,55,55,56,56,57,57,57,58,58,59,59,60,60,60,61,61,62,62,63,63,63,64,64,65,65,66,66,67,67,67,68,68,69,69,70,70,71,71,72,72,73,73,73,74,74,75,75,76,76,77,77,78,78,79,80,80,81,81,82,82,83,83,84,85,85,86,86,87,88,88,89,90,90,91,92,92,93,94,94,95,96,97,97,98,99,100,101,102,102,103,104,105,106,107,108,109,110,112,113,114,115,117,118,120,121,123,125,126,128,130,133,135,138,141,144,147,152,157,163,170,181,200,200],Q0
          SerOut2 LCD, 16468, [clrSCR]
          SerOut2 LCD, 16468, [posCmd, 87, DEC Q0, " C"]
          SerOut2 LCD, 16468, [posCmd, 107, DEC adcount, " adcount"]
    
    IF PORTB.2=1 AND Q0>100 Then
        Low PORTB.2
    EndIF
    
    IF PORTB.2=0 AND Q0<50 Then
        High PORTB.2
    EndIF
    
    
    GoTo Loop
    
    End

    It won't let me upload the spreadsheet.
    Last edited by ScaleRobotics; - 3rd February 2011 at 12:11. Reason: added code tags

Similar Threads

  1. Gps/glcd
    By karenhornby in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 1st April 2008, 17:18
  2. math operator LOG
    By Eyal in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 23rd July 2004, 00:45
  3. Log and exponential
    By anj in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 5th March 2004, 21:03

Members who have read this thread : 0

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