need help on display problem


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1

    Default need help on display problem

    hi every body..
    as a newbies, i need help n some advise from anyone who willing to help me..
    im doing a temperature measurement project..my problem is i try to display the result on three type of display which is a row of ten leds display, lcd and by pc.. the leds works just find if i just display the data on the leds but it wont display anything if i program it to display the result on the leds together with the lcd and the lcd also wont display anything..im using pic 16f877 and 16X2 lcd..

    my code as below..

    DEFINE ADC_BITS 10 ' ADC PARAMETER
    DEFINE ADC_CLOCK 3
    DEFINE ADC_SAMPLEUS 50

    DEFINE LCD_DREG PORTD 'CONFIGURE LCD
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTC
    DEFINE LCD_RSBIT 2
    DEFINE LCD_EREG PORTC
    DEFINE LCD_EBIT 3
    DEFINE LCD_BITS 8
    DEFINE LCD_LINES 2

    Define HSER_RCSTA 90h ' serial setting
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_BAUD 2400
    DEFINE HSER_SPBRG 25
    Define HSER_CLROERR 1

    MEASURED_VALUE VAR word ' declare variable


    TRISA = %00000001
    TRISB = %00000000
    TRISC.0 = %0
    TRISC.1 = %0
    ADCON0 = %10000101
    ADCON1 = %10000000

    pause 500

    START:

    ADCIN 0 , MEASURED_VALUE ' DISPLAY ON LEDS
    pause 100
    PORTB= ~MEASURED_VALUE.LOWBYTE
    pause 100
    PORTC.0= ~MEASURED_VALUE.8
    pause 100
    PORTC.1= ~MEASURED_VALUE.9
    pause 100

    END

    START2:

    LCDOUT $FE,1 ' DISPLAY ON LCD
    LCDOUT "VALUE: ", BIN MEASURED_VALUE.lowbyte
    PAUSE 1000
    END

    START3:

    HSEROUT [ BIN MEASURED_VALUE, 10] ' SEND TO PC
    PAUSE 100
    GOTO START

    END


    i hope somebody will teach n advice me on how to solve it..thank you

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Try this:

    DEFINE ADC_BITS 10 ' ADC PARAMETER
    DEFINE ADC_CLOCK 3
    DEFINE ADC_SAMPLEUS 50
    DEFINE LCD_DREG PORTD 'CONFIGURE LCD
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTC
    DEFINE LCD_RSBIT 2
    DEFINE LCD_EREG PORTC
    DEFINE LCD_EBIT 3
    DEFINE LCD_BITS 8
    DEFINE LCD_LINES 2
    DEFINE HSER_RCSTA 90h ' serial setting
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_BAUD 2400
    DEFINE HSER_SPBRG 25
    DEFINE HSER_CLROERR 1
    MEASURED_VALUE VAR word : TRISA = 1 : TRISB = 0 : TRISC.0 = %0
    TRISC.1 = %0 : ADCON0 = $85 : ADCON1 = $80 : pause 500
    START:
    ADCIN 0 , MEASURED_VALUE : pause 100
    PORTB= ~MEASURED_VALUE.LOWBYTE : pause 100
    PORTC.0= ~MEASURED_VALUE.8 : pause 100
    PORTC.1= ~MEASURED_VALUE.9 : pause 100
    START2:
    LCDOUT $FE,1 : LCDOUT "VALUE: ", BIN MEASURED_VALUE.lowbyte : PAUSE 1000
    START3:
    HSEROUT [ BIN MEASURED_VALUE, 10] : PAUSE 100
    GOTO START
    END

    Let us know what happens...

  3. #3


    Did you find this post helpful? Yes | No

    Default my leds work but my lcd still sleeping..

    hi there..thanks alot.. its realy help..my leds working...but still my lcd wont work..maybe i should check the wiring back..but..still i dont get it..how come ur code make it work but mine not..coz i dont see a big different in ur code..whats wrong with mine?..if u have a time..do plz explain to me

    thanks again..

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sixty9sandals View Post
    hi there..thanks alot.. its realy help..my leds working...but still my lcd wont work..maybe i should check the wiring back..but..still i dont get it..how come ur code make it work but mine not..coz i dont see a big different in ur code..whats wrong with mine?..if u have a time..do plz explain to me

    thanks again..
    Try looking for the word 'END' in my code, then try looking for the word 'END' in your code, finally, try looking for the word 'END' in the little green manual.

  5. #5


    Did you find this post helpful? Yes | No

    Default ic..i get it now..

    i never think that such a small mistake have make me lost 2 days of my life ,figure out what went wrong...again..thanks alot for this wonderful lesson..u have no idea how smiling im now..now im trying to figure out what error ive done in my wiring..hope it wont take my other 2 days of my life...

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sixty9sandals View Post
    i never think that such a small mistake have make me lost 2 days of my life ,figure out what went wrong...again..thanks alot for this wonderful lesson..u have no idea how smiling im now..now im trying to figure out what error ive done in my wiring..hope it wont take my other 2 days of my life...
    Give the LCD at least a second of 'pause' before you try to write to it. Change the data_us and command_us (as described in the green book) to 2000 for command and about 200 for data (but not over 255, byte value for data_us).
    If that doesn't work, play with the contrast voltages, vary it from ground to Vcc on the LCD, hold the LCD at crazy angles and see if you can see anything on it.

Similar Threads

  1. Hdsp 21xx display
    By Original in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th June 2012, 20:07
  2. Replies: 14
    Last Post: - 26th September 2007, 05:41
  3. 7-segment display blinking problem?
    By serdar_ozcan in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 14th March 2006, 14:43
  4. 7 segment digit problem (using Mister E's code)
    By jmgelba in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 9th September 2005, 20:25
  5. 4x20 LCD Display Problem
    By kayki in forum mel PIC BASIC
    Replies: 0
    Last Post: - 24th August 2005, 15:42

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