Problems with 18F458


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    Join Date
    Aug 2005
    Posts
    12


    Did you find this post helpful? Yes | No

    Default

    I use a 4 Mhz crystal as osc. and I use PORTB as output, this is what my code looks like, I have included the library for LCD in the txt file:

    LIST p=18F458 ;tell assembler what chip we are using
    include "p18f458.inc" ;include the defaults for the chip
    ERRORLEVEL 0, -302 ;suppress bank selection messages

    cblock 0x20 ;start of general purpose registers
    ;LCD
    count ;used in looping routines
    count1 ;used in delay routine
    counta ;used in delay routine
    countb ;used in delay routine
    tmp1 ;temporary storage
    tmp2 templcd ;temp store for 4 bit mode
    templcd2

    endc

    LCD_PORT Equ PORTB
    LCD_TRIS Equ TRISB
    LCD_RS Equ 0x04
    LCD_RW Equ 0x06
    LCD_E Equ 0x07


    ;--------Program-------------------


    SetPorts
    movlw 0x00 ;make all pins outputs
    movwf LCD_TRIS ;wait for LCD to settle
    call Delay100
    call LCD_Init ;setup LCD
    call LCD_CurOff

    ld
    call LCD_Line1
    movlw 'H'
    call LCD_Char
    movlw 'e'
    call LCD_Char
    movlw 'l'
    call LCD_Char
    movlw 'l'
    call LCD_Char
    movlw 'o'
    call LCD_Char
    movlw ' '
    call LCD_Char
    movlw 'W'
    call LCD_Char
    movlw 'o'
    call LCD_Char
    movlw 'r'
    call LCD_Char
    movlw 'l'
    call LCD_Char
    movlw 'd'
    call LCD_Char
    movlw '!'
    call LCD_Char
    movlw '!'
    call LCD_Char
    movlw '!'
    call LCD_Char

    endprg goto endprg


    include <lcd.lib>


    ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    end
    Attached Files Attached Files

  2. #2
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Russian,

    Do you have a pullup resistor on MCLR ?

    And hey, this is a PICBASIC Forum !
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  3. #3


    Did you find this post helpful? Yes | No

    Default

    Sorry but assembly is greek to me.

  4. #4
    Join Date
    Sep 2004
    Location
    Tallinn, Estonia
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    Did you configure your 18f458 correctly? Especially LVP_OFF! This was the mistake, i made.
    Here is my code, check for the LCDPUTCHAR routine.
    Attached Files Attached Files

  5. #5
    Join Date
    Aug 2005
    Posts
    12


    Did you find this post helpful? Yes | No

    Default

    I'm sorry, I know that this is a PIC Basic forum thats why I hadn't posted my code In the first thread. Yes, I have a pullup on MCLR, and LVP is off. Here I have a picture of what my screen shows when my program tries to write "Hello world!!!"
    Attached Images Attached Images  

  6. #6
    Join Date
    Sep 2004
    Location
    Tallinn, Estonia
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    May-be your clock speed is too high? PLL ON perhaps?
    Try simulating your code in MPLAB. If this works OK, it's something in hardware. If not, you'll find the bug quickly.

  7. #7


    Did you find this post helpful? Yes | No

    Default

    I was just looking at your picture an couldn't help but notice the leads coming for the crystal. Shouldn't there be a empty space in between the pins. It looks like the pins are spaced at 0.100". It might be just the picture but I think the crystal is actually 0.200" pin spacing.

Similar Threads

  1. Problems programming
    By Lionheart in forum General
    Replies: 4
    Last Post: - 7th December 2008, 16:51
  2. bootloader Freqout problems
    By handgio in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th December 2007, 13:38
  3. Problems with PORTD on 18F658
    By blainecf in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th June 2006, 17:32
  4. Problems with 16F876 on interrupts an WRITE / READ
    By BigWumpus in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th December 2005, 14:38
  5. USART problems
    By egberttheone in forum mel PIC BASIC Pro
    Replies: 47
    Last Post: - 6th March 2005, 21:45

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