Trouble with LCD 2x8 and sequential display of values


Closed Thread
Results 1 to 31 of 31

Hybrid View

  1. #1
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240


    Did you find this post helpful? Yes | No

    Default Re: Trouble with LCD 2x8 and sequential display of values

    Can you attache the files? ( your code and elapsed.bas)
    Thanks and Regards;
    Gadelhas

  2. #2
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Re: Trouble with LCD 2x8 and sequential display of values

    The code is in post #1 ; this is the "header" :
    Code:
    @ DEVICE PIC16F684, INTRC_OSC_NOCLKOUT, WDT_OFF, PWRT_ON, BOD_OFF, MCLR_ON, PROTECT_ON
    
    DEFINE OSC 4
    
    TRISA= %00010000                           
    TRISC= %00110000
                    
    CMCON0 = %00000111          ' Disable analog comparators.     
    VRCON  = %00000000           ' Disable Comparator Voltage Reference
    ANSEL  = %00010000           ' Set pin (AN2) to analog input, the rest to digital
    ADCON0 = %10001101           ' Set up A/D converter - Right Just., VDD REF., CH 3, ON
    ADCON1 = %00110000           ' Set up A/D Converter clock source to internal RC
    
    DEFINE ADC_BITS 10       
    DEFINE ADC_CLOCK 3
    DEFINE ADC_SAMPLEUS 50   
                         
    DEFINE LCD_DREG PORTC           ' LCD on port c
    DEFINE LCD_DBIT 0               ' Data bits C0..C3
    DEFINE LCD_RSREG PORTA          ' RS on PORTA
    DEFINE LCD_RSBIT 1              ' RS on A1 
    DEFINE LCD_EREG PORTA           ' E on PORTA
    DEFINE LCD_EBIT 2               ' E on A2
    DEFINE LCD_BITS 4               ' LCD 4 bit mode
    DEFINE LCD_LINES 2              ' 2 line LCD display
    Define LCD_COMMANDUS 2000       ' Command Delay (uS)
    Define LCD_DATAUS 50            ' Data Delay (uS)
    
    Temperature1     Var    Word    
    Temperature2     Var    Word           
    TempC1           Var    Word
    TempC2           Var    Word
    Float1           Var    Word
    Float2           Var    Word
    Sign1         Var    Byte            
    Sign2         Var    Byte        
    DQ1         Var    PORTC.5 ' OUT SENSOR      
    DQ2         Var    PORTC.4 '  IN SENSOR    
    
    
    Twist1           Var    Bit
    Dummy1           Var    Byte
    V1               Var    Word
    Twist2           Var    Bit
    Dummy2           Var    Byte
    V2               Var    Word
    symb             Var    Byte
    
    Vfs             con     20480   ' 20,480v 
    K16             con     61441   ' coefficiente filtro 15/16
    Vbatt           Var     Word    ' Vbatt filtrato
    TmpW            Var     Word
    Acc_Vbatt       Var     Word    ' accumulatore Vbatt filtrato * 16
    batt            Var     Word
    
    DS18B20_1_12bit CON %01111111   ' 750ms,   0.0625°C  (default)
    DS18B20_2_12bit CON %01111111   ' 750ms,   0.0625°C  (default)
         
    LCDOUT  254,64,4,10,4,0,0,0,0,0          ' Cust Char #0  ; http://www.darreltaylor.com/files/CustChar.htm
    LCDOUT  254,72,10,31,17,17,17,17,31,0    ' Cust Char #1  
    LCDOUT  254,80,10,31,17,17,17,31,31,0    ' Cust Char #2  
    LCDOUT  254,88,10,31,17,17,31,31,31,0    ' Cust Char #3  
    LCDOUT  254,96,10,31,17,31,31,31,31,0    ' Cust Char #4  
    LCDOUT  254,104,10,31,31,31,31,31,31,0   ' Cust Char #5
    LCDOUT  254,112,15,3,5,9,16,16,16,0      ' Cust Char #6  
    LCDOUT  254,120,1,1,1,18,20,24,30,0      ' Cust Char #7  
    
    include "Elapsed.bas"
    
    Twist1 = 0
    Twist2 = 0
    
    Pause 5000
    LcdOut $FE, $80," TERMO "
    LcdOut $FE, $C0,"  VOLT "
    PAUSE 3000
    LCDOUT $FE, 1, $FE, $0C                     ' Clear display, cursor off
    Pause 200
    
     ;Init Sensor 1
     OWOUT DQ1, 1, [$CC, $4E, 0, 0, DS18B20_1_12bit]
     OWOut DQ1, 1, [$CC, $48]                       ' Start temperature conversion
     OWOut DQ1, 1, [$CC, $B8] 
     OWOut DQ1, 1, [$CC, $BE] 
     Pause 50
     OWIn DQ1, 2, [temperature1.byte0, temperature1.byte1]
     Pause 50 
     ;Init Sensor 2
     OWOUT DQ2, 1, [$CC, $4E, 0, 0, DS18B20_2_12bit]
     OWOut DQ2, 1, [$CC, $48]                       ' Start temperature conversion
     OWOut DQ2, 1, [$CC, $B8] 
     OWOut DQ2, 1, [$CC, $BE] 
     Pause 50
     OWIn DQ2, 2, [temperature2.byte0, temperature2.byte1]
     Pause 50
    More about "Elapsed.bas" (credits to Mr.Darrel !) here : http://www.picbasic.co.uk/forum/show...7473#post17473
    Thanks again for support !

  3. #3
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240


    Did you find this post helpful? Yes | No

    Default Re: Trouble with LCD 2x8 and sequential display of values

    I copied your code, and i can not see that error, however, instead of the;

    Code:
    @ INT_DISABLE   TMR1_INT
    
     '1 wire stuff
    
    @ INT_ENABLE   TMR1_INT
    try this;

    Code:
        T1CON.0 = 0                   ; Turn OFF Timer1
    
     '1 wire stuff
    
        T1CON.0 = 1                   ; Turn ON Timer1
    Thanks and Regards;
    Gadelhas

  4. #4
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Re: Trouble with LCD 2x8 and sequential display of values

    I tried this way, but...the timer stop counting (so, I can't display 5 sec. IN and 5 sec. OUT) and the reading of sensor(s) it's not continous....like in my "original" code ...
    I want to read permanent the sensors (for sensing the variation of temperatures) and display the temperature, 5 seconds from first sensor, the next 5 seconds from second sensor, so on, so on ....
    Otherwise I can write the code like this :
    " display temperature 1
    pause 5000
    display temperature 2
    pause 5000
    goto loop "
    which is not a good option ...

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