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

    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.

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

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

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

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


    Did you find this post helpful? Yes | No

    Default

    yeah right but how about if you move the main HSERIN to the interrupt routine?
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    What happens if you remove the line?:

    DEFINE NO_CLRWDT 1

    When I plugged you code into MPLAB and ran the sim, it gave me a watchdog timeout.

    Steve

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


    Did you find this post helpful? Yes | No

    Default

    but if the watchdog timer is not set in the config fuse, it won't change anything... at least i guess.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    mister_e,

    You insight is very helpful! Interrupts were, indeed killing the HSEROUT routine. Setting INTCON to "0" just before the HSEROUT allows the characters to be output properly.

    Grabbing the character with HSERIN inside the ISR works as well!

    This helps a lot, but I don't believe that I can disable ints during serial transmission. MAYBE I can work around this.

    It would be nice to know if I have a bug in my ISR, or if PBP itself has a bug that prevents HSEROUT from being an interruptable routine.

    By the way. Everyone else seems to have found a nice way to include formatted code without putting it "in line". Could you please tell me how to do that?
    Charles Linquist

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


    Did you find this post helpful? Yes | No

    Default

    Great!!!

    look the following link for VB code
    http://www.picbasic.co.uk/forum/misc.php?do=bbcode
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Just to answer the random notes around the thread and also to summarize:

    The watchdog timer was disabled during programming.
    The interrupt worked exactly as expected (that is, it DID provide a 'tick' every
    millisecond).

    Writing the interrupt in pure assembly, saving Wreg,STATUS, FSR0L, and FSR0H
    produced EXACTLY the same result as using a modified "Tim Box" routine which saves the same registers as above PLUS all the PBP registers.

    Does this prove that HSEROUT cannot be interrupted? I have a question in to MELabs.
    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