LCDout and large filesize 18F452 -> paging problem?


Closed Thread
Results 1 to 19 of 19

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Be careful with 18Fs.. when you write to a PORT you should use LATx instead of PORTx. If you write to adjacent bits, you should write to a shadow register first, then copy it to the whole port to avoid the Read-Modify-Write behaviour.

    I would tend to change the LCDOUT statement... reading the Magn bit (from PORTD.7), save the result to a Temp variable then after show the result. When writing to Magn, you use LATD.7.
    Steve

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

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    Be careful with 18Fs.. when you write to a PORT you should use LATx instead of PORTx. If you write to adjacent bits, you should write to a shadow register first, then copy it to the whole port to avoid the Read-Modify-Write behaviour.

    I would tend to change the LCDOUT statement... reading the Magn bit (from PORTD.7), save the result to a Temp variable then after show the result. When writing to Magn, you use LATD.7.
    I've never used, or had to use, LATD.x on the 18F's.
    But if you say it takes care of some of the R-M-W issues, then it must be true.

  3. #3
    Join Date
    Jan 2008
    Location
    Finland
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    > I've never used, or had to use, LATD.x on the 18F's.
    > But if you say it takes care of some of the R-M-W issues,
    > then it must be true.

    This might be worth deepper inspection..

    I'm sorry I didn't identify the problem clearly-basicly LCDout works just fine. LCD-display can be used only for testing purposes cause it's so damn slooooow.. o:-) That's why all lcd-routines are normally bypassed by "naytto" input signal. Only problem is that if I want to use LCDout for testing, it will shut down (low) portD.7 output (MAGN) as well.. There cannot be hardware problem cause in next line I put pulsout portD.7,65530 command for testing purposes and it will flash Led in portD.7 but I cannot understand why in previous line command portD.7=1 (Magn=1) will NOT illuminate the same led.. (see line marked in RED=near lines 145 and 182)
    Attached Images Attached Images

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


    Did you find this post helpful? Yes | No

    Default

    as i said, you want to use LATD instead of PORTD. Pulsout also do more than a single PORT/LAT=x. If my memory serves me well it set the TRIS.. then do what it has to do. Hence wasting a few instruction cycle before and after... why the R-M-W behaviour don't happen.. or is reduced to a minimum.
    Steve

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

  5. #5
    Join Date
    Jan 2008
    Location
    Finland
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    > as i said, you want to use LATD instead of PORTD.

    Ok, u do have a point and that must be the issue here.. BUT..
    could it be so that the LCDout-command is causing this RMW behaviour and not the other way around?
    I mean without LCDout everything works fine.. o:-)
    what can I do about that build-in LCDout-command?
    I don't have time and energy to write my own LCDout-command..
    o:-)

  6. #6
    Join Date
    Jan 2008
    Location
    Finland
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    > as i said, you want to use LATD instead of PORTD.

    Ok, Now i know it is about RMW. As I put "pause 5000" right after portD.7=1 command, the led in portD.7 will light for 5seconds.

    There ain't any other solution than find another port for output-like portB.1?
    Last edited by mara; - 24th January 2008 at 22:28.

  7. #7
    Join Date
    Jan 2008
    Location
    Finland
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    as i said, you want to use LATD instead of PORTD. Pulsout also do more than a single PORT/LAT=x. If my memory serves me well it set the TRIS.. then do what it has to do. Hence wasting a few instruction cycle before and after... why the R-M-W behaviour don't happen.. or is reduced to a minimum.
    Ok, now it works: instead of portD.7=1 I write:

    latd.7=0
    latd.7=1

    and now portD.7 will stay high even if LCDout is used..
    BUT.. why do I have to do it that way? o:-)

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