16F872 and LCD


Closed Thread
Results 1 to 40 of 49

Thread: 16F872 and LCD

Hybrid View

  1. #1
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    Yes i have.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Give this a shot:

    Code:
    @ DEVICE PIC16F872, HS_OSC, WDT_OFF, PWRT_ON, LVP_OFF, PROTECT_OFF
    DEFINE OSC 20
    DEFINE LCD_COMMANDUS 3000
    DEFINE LCD_DATAUS 250
    temperature var word : count_remain var byte : count_per_c var byte
    dq var portb.2 : ADCON1 = 7 : pause 1000 : lcdout $fe , 1
    mainloop: OWOut DQ , 1 , [ $CC , $44 ]
    waitloop: OWIn DQ, 4, [count_remain]	 : If count_remain = 0 Then waitloop
    owout dq, 1, [$cc,$be]
    owin dq , 0 , [ temperature.lowbyte , temperature.highbyte , skip 4 , count_remain , count_per_c ]
    temperature = ( ( ( temperature >> 1 ) * 100 ) - 25 ) + ( ( ( count_per_c - count_remain ) * 100 ) / count_per_c )
    Lcdout $fe , $80 , DEC3 ( temperature / 100 ) , "." , DEC2 temperature, " C"
    temperature = ( temperature * / 461 ) + 3200
    Lcdout $fe , $c0 , DEC3 ( temperature / 100 ) , "." , DEC2 temperature , " F"
    Pause 1000 : goto mainloop

    Also, in your original code, you show:
    define OSC 20

    Put all DEFINE's in upper case. It's a bit weird like that.
    Your original code was probably still compiled as if it were for a 4 Mhz oscillator, even though you had 'define OSC 20'.
    Last edited by skimask; - 17th January 2008 at 18:47.

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