Still HSEROUT woes


Closed Thread
Results 1 to 35 of 35

Hybrid View

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


    Did you find this post helpful? Yes | No

    Post

    mmm,
    Code:
    asm
    MOVFF WREG,wsave ; copy W to wsave register
    MOVFF STATUS,ssave
    CLRF STATUS ; change to bank 0 regardless of current bank
    
    INT_CODE
    
    MOVFF R0,_R0_2
    MOVFF R0+1,_R0_2+1
    should be..
    Code:
    asm
    INT_CODE
        MOVFF WREG,wsave ; copy W to wsave register
        MOVFF STATUS,ssave
        CLRF STATUS ; change to bank 0 regardless of current bank
    
    
    
        MOVFF R0,_R0_2
        MOVFF R0+1,_R0_2+1
    Steve

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

  2. #2
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Steve, you are absolutely correct. One of my edits went awry.

    Unfortunately, when I put the INT_CODE line in the correct place,
    nothing changes. Still no joy.


    And mister_e,

    The lines are part of my "standard" header file. I can't tell you why they
    are there. Probably some legacy issue. Anyway. I took them out.
    No change in behavior.
    Charles Linquist

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


    Did you find this post helpful? Yes | No

    Default

    O.k then i'll try again

    Beeing said i already heard of some care about the Tim's routine.. i just don't remind where but.. humm.

    Now i'm very bad and slow in assembler debugging so, apologies..
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    just an idea... how about replacing the Hserout by a TXREG=Char loop. Just by seeing the output of it, it seems the routine just redo the Hserout line without keeping track of what have been already sent...

    OR it have to exist a character pointer variable in the HSEROUT macro somewhere... if so, you probably didn't save it in the INT Handler... mmm interesting....
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    pfff... maybe
    Code:
        IF TimerFlag = 1 THEN
           SecondsCounter = SecondsCounter + 1
           INTCON = 0
           HSEROUT ["Seconds = ",#SecondsCounter,13,10]
           INTCON = %11100000 
           TimerFlag = 0
           Timer = 0
           ENDIF
    
        IF KeyHitFlag = 1 THEN
           INTCON = 0
           HSERIN [Y]
           HSEROUT[Y]
           INTCON = %11100000 
           KeyHitFlag = 0
           ENDIF
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    ah come on brain cell (no s)... wake up...
    Code:
    IF INTCON.2 = 1 THEN
    TMR0H = $EC ; Reload TMR0 to 65535 - 5000
    TMR0L = $77
    Timer = Timer + 1
    IF Timer >= 1000 THEN
    TimerFlag = 1
    ENDIF
    
    ENDIF
    
    IF PIR1.5 = 1 THEN
    KeyHitFlag = 1
    ENDIF
    INTCON.2 = 0 ; Clear the timer flag
    where the PIR1.5 is cleared?
    Last edited by mister_e; - 9th July 2006 at 21:53.
    Steve

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

  7. #7
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    In the PBP program. HSERIN clears the flag.
    Charles Linquist

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


    Did you find this post helpful? Yes | No

    Default

    Nicely done! That show and confirm my assembler limitation and some basic register knowledge. I really have to work harder on that.
    Steve

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

  9. #9
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Correction: The HSEROUT works as expected, the HSERIN does not. But I was really only looking at the interaction between interrupts and HSEROUT to begin with. I'll take a closer look at the HSERIN now.

    Steve
    Last edited by SteveB; - 10th July 2006 at 04:06.

  10. #10
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Well, Just moving
    HSERIN [Y]
    HSEROUT[Y]
    into the ISR solved the HSERIN as mentioned.

    Despite getting it working on my equipment, we still don't know why it isn't working for Charles. I'd like to know why the difference.

    Steve

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


    Did you find this post helpful? Yes | No

    Default

    well let's see it in the simplest way... an Interrupt flag have been set, it jump to the ISR but he's not clear before going out... what happen? it return back to the ISR as soon as possible.

    As it's just a single character.. HSERIN can be changed to
    Code:
    x=RCREG
    While RCREG : Discard=RCREG : Wend
    or few lines of assembler...

    OUF, at least i wasn't too far.. that's good for my own self esteem
    Last edited by mister_e; - 10th July 2006 at 04:20.
    Steve

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

  12. #12
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    I can deal with the requirement to read the RCREG from within the ISR, but having to shut off the interrupts while running HSEROUT is more problematic. I have to run full-duplex in my application. That is why I needed it interrupt-driven in the first place!
    Charles Linquist

  13. #13
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    SteveB:

    Confirming - I took your code and loaded it into my 8720. It works as expected, except that it doesn't handle USART interrupts (as you mentioned). I'm thinking that your routine works better because you saved/restored BSR, while I was was saving/restoring FSR0L and FSR0H.

    I have an email to MELABS. Maybe they can shed some light on this.

    When we are done, I think we will have a good framework for how to deal with interrupts in the 18F series!
    Charles Linquist

Similar Threads

  1. I2C Slave with a PIC
    By ralfmayr in forum mel PIC BASIC Pro
    Replies: 129
    Last Post: - 21st August 2016, 18:44
  2. hserin and sms controller
    By xxxxxx in forum mel PIC BASIC Pro
    Replies: 25
    Last Post: - 10th February 2010, 16:49
  3. HSEROUT and Commas, What? Help Me Understand
    By altech6983 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 20th July 2009, 20:12
  4. Is HSEROUT corrupting bit 7 ?????
    By Robert Wells in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd October 2008, 17:26
  5. Controlling an 240x128 LCD Touchpanel Display
    By Vincent in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 8th June 2006, 00:36

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