LCDout and large filesize 18F452 -> paging problem?


Closed Thread
Results 1 to 19 of 19

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    > You tend to forget things like RETURN after a GOSUB..

    Yep, gosubs and if-then-else-endif structures are like women-
    one has to be veeery careful with them.. o:-)

    I downsized the code a little bit - any comments?

    It works if naytto is low,
    If naytto is high then portD.7 wont go high (except pulsout-command)
    Last edited by mara; - 24th January 2008 at 21:14. Reason: pdf updated

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mara View Post
    > You tend to forget things like RETURN after a GOSUB..
    Yep, gosubs and if-then-else-endif structures are like women-
    one has to be veeery careful with them.. o:-)
    I downsized the code a little bit - any comments?
    It works if naytto is low,
    If naytto is high then portD.7 wont go high (except pulsout-command)
    Yes, does the code in Post #6 work?

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


    Did you find this post helpful? Yes | No

    Default

    > Yes, does the code in Post #6 work?
    Well, did ya mean reversing direction-bit of portD.7?
    I don't think it would resolve the problem-
    in this case the problem is deepper-I think it is in compiler...
    The code works ok, only the LCDout routine is causing problems..
    (=jamming portD.7)

    m.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mara View Post
    > Yes, does the code in Post #6 work?
    Well, did ya mean reversing direction-bit of portD.7?
    I don't think it would resolve the problem-
    in this case the problem is deepper-I think it is in compiler...
    The code works ok, only the LCDout routine is causing problems..
    (=jamming portD.7)

    m.
    Ok, typo on my part...
    TRISD = %10000000 should have been
    TRISD = $40

    Did it work or not?

    Looking at your program as a whole, I think the problem is that the LED is actually coming on, but that it flickers too fast for you to see it. With the pulsout, you are seeing a .13 second pulse, if your code says something to the effect of:
    LED1 = 1
    LED1 = 0
    then you probably won't see it come on at all...unless you got really super special eyes.

  5. #5
    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.

  6. #6
    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.

  7. #7
    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

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