Pic18F452


Closed Thread
Results 1 to 23 of 23

Thread: Pic18F452

Hybrid View

  1. #1
    Join Date
    Jul 2007
    Posts
    3


    Did you find this post helpful? Yes | No

    Default Help Meeeee

    Well, hi everybody ...
    It seems that you all know the basics of how to manage a 2x16 LCD with the famous 18f452 but i don't ..:'(
    I really need to make it work for a project, but here's my problem, i have a pic trainer with the LCD configured to work with the high nibble data bus but it has the RS-->RB2, RE-->RB3 ,R/W-->gnd, and D4-D7 -->RB4-RB7 as you see all in the same portb, i gave on trying it myself. So please could anybody give me a code to display one message on the LCD. I wouldn't mind if you have it for a 16f877 as i have that one too. I know i may be asking too much, but please help me. Thanx
    just in case one of you has mercy on my soul... my email is [email protected]

  2. #2
    Join Date
    Jul 2007
    Posts
    53


    Did you find this post helpful? Yes | No

    Default About ADC_CLOCK

    Mister e, you said

    "ADC_CLOCK 2 refer to ADCS1:ADCS0 bits (ADCON0<7:6>)"

    I would like to know where I can find information about this. Or ,maybe easier, can you explain how ADC_CLOCK is "translated" to Focs/32. Is this simply the decimal value of ADCS1:ADCS0 bits?

    Thanks!

  3. #3
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    GrandPa...

    "ADC_CLOCK 2 refer to ADCS1:ADCS0 bits (ADCON0<7:6>)"

    I would like to know where I can find information about this
    You can find the information you seek and it's all explained in great detail in the DATASHEET for the PIC you are using. Download it from www.microchip.com and study...

    Tip: NEVER program a PIC without first studying it's Datasheet.

    evilpic...

    No, you're not asking too much, but this is very basic stuff that you should be capable of figuring for yourself.

    Take a look at the LCDOUT command located here... http://www.melabs.com/resources/pbpmanual/

    Scroll down until you find the DEFINE statements and change them accordingly for your preferred hardware connections.

    Tip: NEVER program anything without first studying the compiler manual.

  4. #4
    Join Date
    Jul 2007
    Posts
    53


    Did you find this post helpful? Yes | No

    Question Let me explain....

    Thank's Melanie, but I've actually read the datasheet and use it currently. I'm actually setting the ADCON0 register directly instead if using the define.

    My question is very specific about the DEFINE ADC_CLOCK.
    What I don't understand is the meaning of the parameter (number) after the define:

    In the book you have :
    DEFINE ADC_CLOCK 3 'ADC clock source (rc = 3)
    WHY does 3 mean RC clock ?

    And

    Mister e wrote:
    DEFINE ADC_CLOCK 2 ' ADC clock source (Fosc/32)
    Why does 2 mean Fosc/32

    After reading the datasheet, I came to the conclusion that this number is the binary values of ADCS0:ADCS2 (PIC18F4620 here). But I wanted to make sure. So let me ask again:

    ----> Is this the decimal value of ADCS0:ADCS2 ?


    (btw: I'm french, trying my best to explain my question)

    J-P

  5. #5
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Yes, whatever you set in DEFINE ADC_CLOCK n, where 'n' is a number between 0 and 7 will reflect in bits ADCS2:ADCS1:ADCS0 as per the table in the PICs DATASHEET that I refered you to..

    If you set a number greater than 7, then only the lowest three bits of your define will be used... ie DEFINE ADC_CLOCK 8 will set ADCS2=0,ADCS1=0 and ADCS0=0.

    I will add, that if you don't specify a DEFINE ADC_CLOCK in your program, the default value if you use ADCIN will be 3 (ie ADCS2=0, ADCS1=1, ADCS0=1).

  6. #6
    Join Date
    Jul 2007
    Posts
    3


    Did you find this post helpful? Yes | No

    Default hserin..A little help pleeeease!!

    I really need to comunicate a LCD serially with the computer, i'm using the windows hyperterminal to send characters through the RS232 and a MAX232 driver circuit included on my PIC trainer, this is the code i'm using to display those characters on the LCD but all i get is kinda chinese characters or nothing instead of the key i'm pressing... i guess there's something wrong with my hserin but i can't figure what exactly. i'm new to PIC so have mercy on my soul

    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_BAUD 9615
    DEFINE HSER_SPBRG 25
    W0 var BYTE

    'Set LCD Data port
    DEFINE LCD_DREG PORTB
    ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_DBIT 4
    ' Set LCD Register Select port
    DEFINE LCD_RSREG PORTB
    ' Set LCD Register Select bit
    DEFINE LCD_RSBIT 2
    ' Set LCD Enable port
    DEFINE LCD_EREG PORTB
    ' Set LCD Enable bit
    DEFINE LCD_EBIT 3
    ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_BITS 4
    ' Set number of lines on LCD
    DEFINE LCD_LINES 2
    ' Set command delay time in us
    DEFINE LCD_COMMANDUS 2000
    ' Set data delay time in us
    DEFINE LCD_DATAUS 50
    DEFINE HSER_CLROERR 1 'clear overflow error bit

    pause 500
    Lcdout $fe, 1
    W0=0
    again: HSERIN [ W0 ]
    if W0 = 0 then again
    Pause 500 ' Wait for LCD to startup
    Lcdout $fe, 1 ' Clear LCD screen
    Lcdout W0 ' Display W0
    Pause 500 ' Wait .5 second
    goto again

Similar Threads

  1. PIC18f452 blinking led ?
    By iugmoh in forum General
    Replies: 5
    Last Post: - 7th March 2008, 14:12
  2. Serial communication with pic18f452
    By tamersoss in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th December 2007, 21:27
  3. communicating pic18f452 with pic16f877a
    By tamersoss in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th July 2007, 19:54
  4. Dealy in turn ON of PIC18F452
    By genesis in forum General
    Replies: 1
    Last Post: - 13th October 2006, 10:40
  5. Replies: 5
    Last Post: - 26th March 2006, 19:26

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