Today 16:00
Forum: Timer Modules
Starter: See_Mos
Views: 0
Replies: 0
Today 14:22
Forum: The Lounge
Starter: craig
Views: 0
Replies: 22
Go to last post By: See_Mos
Yesterday 19:23
Forum: Absolute Beginners Section
Starter: amod
Views: 0
Replies: 29
+ Reply to Thread
Results 1 to 3 of 3

Thread: Problem with TO bit of RCON20 days old

  1. #1
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    654
    Thumbs Up
    Received: 121
    Given: 2
    Total Downloaded
    3.33 GB

    0 Not allowed!

    Default Problem with TO bit of RCON

    Hi Les,
    In case of debug I wanted to know the all status of the bits of RCON register and mostly the TO bit (watchdog status). As the compiler is configured, it can not be done because the clrwdt instruction has deleted this bit before.
    For example:

    ASM file: If Declare Watchdog = OFF
    Code:
    PROTON#CODE#START
        org 0
        nop
        nop
        goto proton#main#start
        org 8
    Lcd@Cls
        movlw 128
        movwf BPFH,0
        Bla...
        Bla...
        Bla...
    proton#main#start
        clrf BPF,0
        movlw 103
        movwf SPBRG,0
        movlw 36
        movwf TXSTA,0
        movlw 144
        movwf RCSTA,0
        movlb 0
    
        movlw 7
        movwf ADCON1,0
        Bla...
        Bla...
        Bla...
    ASM file: If Declare Watchdog = On
    Code:
    PROTON#CODE#START
        org 0
        clrwdt
        clrwdt
        goto proton#main#start
        org 8
    Lcd@Cls
        movlw 128
        movwf BPFH,0
        Bla...
        Bla...
        Bla...
    proton#main#start
        clrf BPF,0
        movlw 103
        movwf SPBRG,0
        movlw 36
        movwf TXSTA,0
        movlw 144
        movwf RCSTA,0
        movlb 0
    
        movlw 7
        movwf ADCON1,0
        Bla...
        Bla...
        Bla...
    Then the TO bit is always deleted and it is not possible to know if the watchdog was the cause of a reset.
    Could it be possible change the code with NO clrwdt in position 0 but like this.

    ASM file: If Declare Watchdog = On
    Code:
    PROTON#CODE#START
        org 0
        nop
        nop
        goto proton#main#start
        org 8
    Lcd@Cls
        movlw 128
        movwf BPFH,0
        Bla...
        Bla...
        Bla...
    proton#main#start
        movff RCON,RCONBits
        clrwdt
        clrf BPF,0
        movlw 103
        movwf SPBRG,0
        movlw 36
        movwf TXSTA,0
        movlw 144
        movwf RCSTA,0
        movlb 0
    
        movlw 7
        movwf ADCON1,0
        Bla...
        Bla...
        Bla...
    RCONBits could be a Byte variable generated by the compiler to save all bits of RCON before clear the Watchdog timer.

    I would appreciate it if you think about it for a next update of the compiler.
    Thank you.
    Regards
    Alberto
    [U]73's de Alberto ea3agv[/U]

  2. #2
    Fanatical Contributor Les's Avatar
    Join Date
    Feb 2002
    Posts
    3,003
    Thumbs Up
    Received: 304
    Given: 109
    Total Downloaded
    1.50 GB

    0 Not allowed!

    Default Re: Problem with TO bit of RCON

    Thanks Alberto.

    I had totally forgot the RCON, when I used the default nop routines at the start of the program.

    What the compiler does is replace a Nop with a Clrwdt in its library routines if it is enabled, via the Nop function in the compiler's source. They both delay for 1 cycle and perform the same delay task. I'll change the beginning padding nops to nops only in the next update.
    For more example programs for Proton and Proton24 or updates, please visit: Proton WIKI or Proton Files

  3. #3
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    654
    Thumbs Up
    Received: 121
    Given: 2
    Total Downloaded
    3.33 GB

    0 Not allowed!

    Default Re: Problem with TO bit of RCON

    Les,
    Thank you very much for adding this solution. So this will be a great improvement for PDS users. I already have the code written to manage all the RCON bits at the start of the PIC.
    I am really enjoying working with Proton Basic. It is a great and very efficient compiler.
    Thank you again for your dedication.
    Regards
    Alberto
    [U]73's de Alberto ea3agv[/U]

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. 16F676 fuse bit setting problem
    By Roshan in forum Proton Plus Compiler v3
    Replies: 11
    Last Post: 15th October 2015, 15:11
  2. USB dongle problem Win7 64 bit
    By ebtrexler in forum USB License key
    Replies: 4
    Last Post: 15th June 2014, 08:07
  3. Bit control problem with IF
    By zerone in forum Proton Plus Compiler v3
    Replies: 20
    Last Post: 4th June 2008, 11:01
  4. [SOLVED !] problem setting port bit low
    By john burke in forum Proton Plus Compiler v3
    Replies: 8
    Last Post: 18th November 2005, 00:44
  5. 15-bit/20-bit Versions of Sony SIRC Protocol
    By insury in forum Proton-IR
    Replies: 1
    Last Post: 21st December 2004, 02:39

Members who have read this thread : 31

Actions :  (Set Date)

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