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

    I dont know what i have done but now the display shows "333333333333333" on both lines and some times the temerature shows on diffrent positions in the display whit "3" all over the display.

    The display is an HD44780 OLED, can the display be broken?

    The PBP Hello World sampel works..

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Fredrick View Post
    I dont know what i have done but now the display shows "333333333333333" on both lines and some times the temerature shows on diffrent positions in the display whit "3" all over the display.
    The display is an HD44780 OLED, can the display be broken?
    The PBP Hello World sampel works..
    I'm sure the 'Hello World' sample works just fine, but when you start messing around with some of the special LCD commands and stuff, the LCD timing starts to matter.
    Did you change the LCD_DATAUS yet?

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


    Did you find this post helpful? Yes | No

    Default

    Yes i have.

  4. #4
    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