Lcd With 16f819


Closed Thread
Results 1 to 7 of 7

Thread: Lcd With 16f819

  1. #1
    Join Date
    Sep 2007
    Posts
    2

    Default Lcd With 16f819

    EDIT: I solved the problem, the EBIT was on set to the wrong pin. Anyway, I will leave the post active if anyone wants to know how to interface a 16F819 with the LCDOUT command in PB. Setting on EPIC Programmer is XT.


    I have tested my circuit on the 16F84A and the LCDOUT program works perfect.

    I am now trying to get this working with 16F819 so I can use the ADC and I just cannot get anything to display on the LCD....any suggestions?
    Also, I am not sure my config for the external osc is correct. I am using a 4Mhz crystal with two 18p caps and selecting XT in the EPIC oscillator Config setting....which worked fine for the 16F84A.

    Code:
    
    DEFINE OSC 4
    
    DEFINE LCD_DREG PORTA	' uses Port A on Ports A 0,1,2,3
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTA
    DEFINE LCD_RSBIT 4
    DEFINE LCD_EREG PORTB
    DEFINE LCD_EBIT 3
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    
    
    TRISA = %00000000 'make Port A outputs
    TRISB = %00000000 'make Port B outptuts
    
    ADCON1 = 7 ' turns off adc
    
    	Pause 1500      ' Wait for LCD to startup
            BlinkyLED VAR PORTB.1    ' This LED will BLINK
    
            Pause 1500       ' Wait for LCD to startup
    
    loop:   
    		High BlinkyLED
    		LCDOut $fe, 1   ' Clear LCD screen
    		Pause 500
            LCDOut "Hello"  ' Display Hello
            Pause 1000       ' Wait 1 second
    
            'LCDOut $fe, 1   ' Clear LCD screen
            LCDOut $fe, $c0 ' Move to next line on LCD
            LCDOut "How are you?" 
            Low BlinkyLED
            Pause 1000       ' Wait 1 second
    
            GoTo loop       ' Do it forever
    Last edited by EliteGM; - 22nd September 2007 at 19:53.

  2. #2
    wilfrieds's Avatar
    wilfrieds Guest


    Did you find this post helpful? Yes | No

    Smile 16F819 using ADC with unstable results

    Hello GM

    I like to use the 16F819 for the same reason.
    It makes no sense to try and use a 4Mhz external osc as the 16F819 has it all build in

    Have a look at my LCD Dash project
    www.skidloaders.co.za/pic

    I am answering your question as I am looking for help myself.
    Nl. My ADC results displayed on the LCD are jumping around
    Both the numerical values as well as the bargraph.
    All this on the breadboard ( see LCDDASH2.JPG)

    Looking forward to anyones assistance.
    Wilfried

  3. #3
    Join Date
    Sep 2007
    Posts
    2


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by wilfrieds View Post
    Hello GM

    I like to use the 16F819 for the same reason.
    It makes no sense to try and use a 4Mhz external osc as the 16F819 has it all build in

    Have a look at my LCD Dash project
    www.skidloaders.co.za/pic

    I am answering your question as I am looking for help myself.
    Nl. My ADC results displayed on the LCD are jumping around
    Both the numerical values as well as the bargraph.
    All this on the breadboard ( see LCDDASH2.JPG)

    Looking forward to anyones assistance.
    Wilfried
    i made a loop that checks to see if the adc is greater than or less than x before changing the LCD display.

    For example...if your ADC is 10 bit then you get 0 to 1024.

    So if your ADC signal is lets say jumping around 345 +/- 3 to 4 then you could LCDOUT and then read the ADC signal into a new variable and compare it to the original...if it is within a few numbers, dont let it out of the loop (dont let it jump back to where your LCDOUT command is until the range is outside of your range interval). Also, use a Zener diode to stabalize the ADC voltage.

  4. #4


    Did you find this post helpful? Yes | No

    Default

    some thing like this I think and your on the wrong forum

    DC_Loops = 20

    Main:

    ADC_Channel = 1 ' ADC on first reference
    GoSub ADC_Average ' Perform an averaging to enhance accuracy

    Temp_Float = ADC_Result ' Store the result

    ADC_Channel = 0 ' ADC on second reference
    GoSub ADC_Average ' Perform an averaging to enhance accuracy

    ADC_Result = ADC_Result * 5000 / 1023 ' Convert values into Volts (with a scale of 1000)
    Temp_Float = Temp_Float * 5000 / 1023 ' to reduce decimal error
    ADC_Result = ADC_Result - Temp_Float ' And calculate difference

    ADC_Result = ADC_Result / 10 ' Scale back down remembering 10mV = 1 Deg C

    If ADC_Result <> Last_Result1 Then ' Check if the data has changed
    Print At 1,1, DEC1 ADC_Result, 0, "C " ' and only update display if it has
    Last_Result1 = ADC_Result ' Store new data
    EndIf

    GoTo Main ' Loop for ever


    ADC_Average: ' Perform an averaging on ADC conversions
    ' to reduce errors
    ADC_Total = 0 ' Clear summing register
    For Temp = 1 To ADC_Loops ' Loop for a pre-determined number of times
    ADC_Result = ADIn ADC_Channel ' Grab a new ADC value
    ADC_Total = ADC_Total + ADC_Result ' Sum it to the total register
    DelayUS 1 ' Allow internal capacitors to discharge
    Next Temp

    ADC_Result = ADC_Total / ADC_Loops ' Determin the average of all the equations

    Return

  5. #5
    wilfrieds's Avatar
    wilfrieds Guest


    Did you find this post helpful? Yes | No

    Default adc stabilized

    Hi guys

    thanks for the tips.
    The adc jumping was sorted out by putting the cap closer to the 7805 regulator.
    A Tantalium cap also improved stability. so for good measure I ised both.

    I also tried ceramic caps but they didn't make any difference.

    The ADC range adjustments seem interesting, still working and experimenting with that one.
    Math calc's don't always seem to be spot on.??? ( maybe it's back to school).

    Regards
    Wilfried

  6. #6
    wilfrieds's Avatar
    wilfrieds Guest


    Did you find this post helpful? Yes | No

    Default adc display

    One more problem remaining.

    How to display say 4.85V from a ADC result.
    Problem being the dot off course.

    Thanks
    Wilfried

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    As your as your result = 485 or 4850, you just need to format it. Look for DIG and DEC modifier in the LCDOUT section.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Is this code not initialising the LCD properly?
    By Platypus in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 30th January 2010, 19:14
  2. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 19:54
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  4. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30

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