A strange problem


Closed Thread
Results 1 to 12 of 12
  1. #1
    Join Date
    Jul 2006
    Location
    Lazio, Italy
    Posts
    41

    Default A strange problem

    Since storage requirements for the 18F252 I left and walked to get on 18f2620 lcd dsplay question marks instead of the value of variables that I use. This problem only affects the contents of variables, the world's other writing appear correctly. Someone has already had this problem? I enclose the listing. thanks very much.


    ' PIC Defines
    ' ===========
    @ __CONFIG _CONFIG1H, _IESO_OFF_1H & _FCMEN_OFF_1H & _OSC_INTIO7_1H
    ' Oscillator Switch-over Disabled
    ' Fail-Safe clock Monitor Disabled
    ' Set for Internal Oscillator RA7 Enabled
    @ __CONFIG _CONFIG2L, _BOREN_OFF_2L & _PWRT_OFF_2L
    ' Brown-Out Reset Enabled
    ' Power-On Timer Enabled
    ' Brown-Out Trip set to 4.2v
    @ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_128_2H
    ' WatchDog is OFF
    ' Watchdog Postscaler set to 1:128

    @ __CONFIG _CONFIG3H, _MCLRE_ON_3H & _PBADEN_OFF_3H & _CCP2MX_PORTC_3H
    ' MCLR is OFF (internal)
    ' PortB 4:0 is digital on Reset
    ' CCP2 is Multiplexed with PortC.1
    @ __CONFIG _CONFIG4L, _STVREN_OFF_4L & _LVP_OFF_4L & _DEBUG_OFF_4L
    ' Stack Under/Overflow will Reset System
    ' Enhanced CPU Addressing Disabled
    ' Low-Voltage Programming is OFF
    ' DEBUG is Disabled

    OSCCON = %11111110 'Internal 8 mhz Osc and stable
    'OSCTUNE.6=1 ' MOLTIPLICATORE PLL X4
    CMCON = %00000111 'Comparators Off


    DEFINE OSC 8 ' Clock a 8 Mhz
    INTCON2.7=0 'ABILITA PORTB PULLUP


    A var BYTe

    DEFINE LCD_BITS 4 'NUMERO LINEE DI COMANDO 4 O 8
    DEFINE LCD_DREG PORTB 'PORTA ChE GESTISCE LCD
    DEFINE LCD_DBIT 4 'BIT INIZIALE BUS
    DEFINE LCD_RSREG PORTB 'PORTA CHE GESTISCE RS
    DEFINE LCD_RSBIT 2 'BIT CHE GESTISCE RS
    DEFINE LCD_EREG PORTB 'PORTA CHE GESTISCE E
    DEFINE LCD_EBIT 3 'PIN CHE GESTISCE IL SEGNALE E
    DEFINE LCD_LINES 2 'NUMERO LINEE LCD

    LCDOUT $FE,1
    PAUSE 500
    LCDOUT $FE,1,"CIAO MAMMA" 'THIS IS DISPLAYED OK
    PAUSE 1000
    LCDOUT $FE,1

    for a=1 to 10
    LCDOUT $FE,DEC2 A 'HERE ARE DISPLAYED: ??????????
    PAUSE 500
    next a

    END

  2. #2
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: A strange problem

    Maybe try

    LCDOUT $FE, $80, DEC2 A

  3. #3
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: A strange problem

    Or try

    LCDOUT $FE, $80, #A

  4. #4
    Join Date
    Jul 2006
    Location
    Lazio, Italy
    Posts
    41


    Did you find this post helpful? Yes | No

    Default Re: A strange problem

    Thanks tasmod, with this statement "LCDOUT $ FE, $ 80, # A" now everything seems to work ok. But what has changed? I have always used "DEC A" and has always worked. What is the problem? Thank you again

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default Re: A strange problem

    Nothing changed. You forgot $80 before your variable.

    Ioannis

  6. #6
    Join Date
    Jul 2006
    Location
    Lazio, Italy
    Posts
    41


    Did you find this post helpful? Yes | No

    Default Re: A strange problem

    No, it is so, even this statement "LCDOUT $FE,$80,DEC A" does not work.

  7. #7
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: A strange problem

    I always did this from early PicBasic days. Can't remember why.

    #A Meaning the decimal representation of an ASCII value.
    I always assumed that in a loop declared as a character, the loop iterated the character the number of times in the loop (i.e. first time round, A=1 in decimal but A was still a character representing that value)

    Hope that makes sense.

  8. #8
    Join Date
    Jul 2006
    Location
    Lazio, Italy
    Posts
    41


    Did you find this post helpful? Yes | No

    Default Re: A strange problem

    Thank you for your interest, but I do not understand is that I have used this statement thousands of times with the 18F252 that I used before. Now I'm in trouble because I need to show the value of "A" sometimes using two digits (DEC2) and sometimes three digits (DEC3) and I do not know how.

  9. #9
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default Re: A strange problem

    Try it without spaces.

    Ioannis

  10. #10
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Default Re: A strange problem

    I was missing something typical to the ' 2620 ... see attachment.

    Your config section looked MUCH too light ...

    ALWAYS ... "RTFM" moreover when using a new processor kind ...
    Attached Images Attached Images
    Last edited by Acetronics2; - 25th January 2012 at 13:37.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  11. #11
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default Re: A strange problem

    Great Alain!

    Ioannis

  12. #12
    Join Date
    Jul 2006
    Location
    Lazio, Italy
    Posts
    41


    Did you find this post helpful? Yes | No

    Default Re: A strange problem

    Thanks Acetronics, you did a great job. RTFM is the answer.

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