Wrong value return...


+ Reply to Thread
Results 1 to 7 of 7

Thread: Wrong value return...5003 days old

  1. #1
    Fanatical Contributor fanie's Avatar
    Join Date
    Oct 2005
    Posts
    7,987
    Thumbs Up
    Received: 31
    Given: 15
    Total Downloaded
    434.52 MB

    0 Not allowed!

    Default Wrong value return...

    Dim Tel As Byte
    Dim Vin As Word
    Symbol Fin = PORTB.5

    Tel = 80
    Vin = Counter Fin , Tel

    does not return the same value in Vin as

    Vin = Counter Fin , 80

    Why not ?
    Fanie

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,703
    Thumbs Up
    Received: 48
    Given: 95
    Total Downloaded
    1.32 GB

    0 Not allowed!

    Default

    Look at the code between the two

    Code:
    F1_000022 equ $ ; in [TEST3.BAS] Vin = Counter Fin , Tel
    	Clrf PP1H
    	Movf TEL,W
    	Movwf PP1
    	Movlw 6
    	Movwf FSR
    	Movlw 32
    	[email protected] [email protected]
    	Movwf VIN
    	Movf PP1H,W
    	Movwf VINH
    F1_000026 equ $ ; in [TEST3.BAS] Vin = Counter Fin , 80
    	Clrf PP1H
    	Movlw 80
    	Movwf PP1
    	Movlw 6
    	Movwf FSR
    	Movlw 32
    	[email protected] [email protected]
    	Movwf VIN
    	Movf PP1H,W
    	Movwf VIN
    Only differnece is


    Clrf PP1H
    Movlw 80
    Movwf PP1

    Clrf PP1H
    Movf TEL,W
    Movwf PP1

    Now both clear PP1H

    one loads the PP1 with the value in TEL the other loads 80 into PP1

    So in essence there is no difference
    Tim

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Fanatical Contributor fanie's Avatar
    Join Date
    Oct 2005
    Posts
    7,987
    Thumbs Up
    Received: 31
    Given: 15
    Total Downloaded
    434.52 MB

    0 Not allowed!

    Default

    Tim, I'm getting major differences !

    from above...

    Vin = Counter Fin , Tel

    takes almost a minute to execute, while

    Vin = Counter Fin , 80

    takes 80ms to execute !

    Also, if I change the value of Tel nothing changes, ie tel = 20 takes just as long.
    Fanie

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,703
    Thumbs Up
    Received: 48
    Given: 95
    Total Downloaded
    1.32 GB

    0 Not allowed!

    Default

    Are you sure there are no other code differences?

    Proton does not write different core routines just because you used a variable.

    Write your code

    View it in asm (F2) then modify it to use a variable (use the code above) recompile in the asm view (F9) and blow into the Pic.

    Give it a test and see what you get.

    Or post the code and I will try it in a VSM.
    Tim

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #5
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,703
    Thumbs Up
    Received: 48
    Given: 95
    Total Downloaded
    1.32 GB

    0 Not allowed!

    Default

    fanie

    I ran this code in the VSM

    Device 16F877
    Dim Tel As Byte
    Dim Vin As Word
    Symbol Fin = PORTB.5
    Tel = 80
    Vin = Counter Fin , Tel
    nop
    ;does not return the same value in Vin as
    Vin = Counter Fin , 80
    nop
    nop

    Before the first Count it was 8us then at the nop after it was 80.263ms at the second nop after the second count it was 160.52ms

    Both approx 80ms
    Tim

  10. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  11. #6
    Fanatical Contributor fanie's Avatar
    Join Date
    Oct 2005
    Posts
    7,987
    Thumbs Up
    Received: 31
    Given: 15
    Total Downloaded
    434.52 MB

    0 Not allowed!

    Default

    Hi Tim,

    I apreciate the trouble you've gone to... sorry I had visitors...I'll dig in some more and see if I can find what's going on. I'll post again if I get stuck.

    Thanks again.
    Fanie

  12. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  13. #7
    Fanatical Contributor fanie's Avatar
    Join Date
    Oct 2005
    Posts
    7,987
    Thumbs Up
    Received: 31
    Given: 15
    Total Downloaded
    434.52 MB

    0 Not allowed!

    Default

    Tim, just to say I found the problem... The Tel value is saved into eeprom. To know if it was calibrated before the program checks if a value was saved or not. I checked for a 0 in this register only, but it occured to me it could be FF too... which was the case so the comparison never picked the FF value up, hence the long time to execute the counter command.

    Problem solved... this pic can now change gears and scream through it's ranges.

    Thanks again again.
    Fanie

  14. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

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

     

Similar Threads

  1. Return while in While..Wend loop
    By towlerg in forum Proton Plus Compiler v3
    Replies: 4
    Last Post: 17th December 2016, 19:35
  2. Replies: 5
    Last Post: 4th April 2014, 12:26
  3. [SOLVED !] Never to Return
    By crankshaft in forum Proton Plus Compiler v3
    Replies: 6
    Last Post: 19th December 2011, 04:29
  4. [SOLVED !] Subrutine - Return
    By Dave-S in forum Proton Plus Compiler v3
    Replies: 14
    Last Post: 12th May 2007, 22:31
  5. No Return from Sub
    By Dave-S in forum Proton Plus Compiler v3
    Replies: 7
    Last Post: 23rd April 2007, 14:34

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts