Shop OBEX P1 Docs P2 Docs Learn Events
SxSim v2.08.06 issue with I/O panel — Parallax Forums

SxSim v2.08.06 issue with I/O panel

Peter VerkaikPeter Verkaik Posts: 3,956
edited 2009-02-16 21:46 in General Discussion
Gunther,

When I make a single pin of rb an output (eg. output rb.2),
the I/O panel shows rb pins 7-4 also as outputs.
This only happens when using SX48/52

regards peter

Comments

  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2009-02-14 21:47
    Perter,

    thank you for your bug report.

    Please let me check it - I'll report later...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2009-02-16 09:50
    Peter,

    tried to repeat this problem here with no result, i.e. here the control panel shows only such pins as output that were defined as outputs before.

    Which version of SXSim are you using, and could you please send me a code snippet showing this bug?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2009-02-16 10:29
    Gunther,

    The attached program merely sets rb.0 as output,
    but rb.7-rb.4 show up as outputs too.
    Compile with sxb 2.00.11


    regards peter
  • mojorizingmojorizing Posts: 249
    edited 2009-02-16 15:42
    I confirm what Peter sees, but I think it's an issue with the compiler v. 3.2.92, and the way it's setting up the TRIS_B register with the Mode register. SXSim is doing what the LIST file (generated from the IDE) is telling it to do correctly.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Bad spellers of the world untie!
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2009-02-16 15:54
    This is the code from the list file
       137  0011  0C0F        MOV W,#$0F                     ;  output rb.0
       138  0012  0043        MOV M,W                       
       139  0013  0006        MOV !RB,W                     
       140  0014  002A        MOV __PARAM1,W                
       141  0015  040A        CLRB __PARAM1.0               
       142  0016  0C1F        MOV W,#$1F                    
       143  0017  0043        MOV M,W                       
       144  0018  020A        MOV !RB,__PARAM1              
            0019  0006
    

    Upon powerup the tris_b register is read and stored in __param1.
    Then b0 gets cleared (eg. make pin 0 output) and this new value
    is written to the tris_b register.
    I don't see how b7-b4 get cleared, unless they're clear
    when reading the tris_b register, which cannot be
    as pins are inputs upon powerup.

    regards peter
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2009-02-16 16:03
    When I add a MOV W,#$FF prior to reading the tris_b register
    then I only see pin0 as output.

      MOV W,#$0F                     ;  output rb.0
      MOV M,W                       
      [b]MOV W,#$FF[/b]
      MOV !RB,W                     
      MOV __PARAM1,W                
      CLRB __PARAM1.0               
      MOV W,#$1F                    
      MOV M,W                       
      MOV !RB,__PARAM1              
    
    

    But when reading tris_b, W should not be written to tris_b.
    Edit:
    It looks like sxsim retains the value of w prior to reading tris_b (which is $0F without the extra MOV)
    That would explain why we see p7-p4 as output too.

    regards peter


    Post Edited (Peter Verkaik) : 2/16/2009 4:13:37 PM GMT
  • mojorizingmojorizing Posts: 249
    edited 2009-02-16 21:46
    You're right, Peter.· And this isn't an issue with the compiler, because your rbio.sxb works in debug, but not with SXSIM.· The tris_b register is not being read correctly as you say.


    The following incorrect answer was done under duress - Monday morning with no coffee....
    Looking at this with an earlier version of the compiler, the code compiles the same way - to initialize the pins to input, it uses the same asm as in your rbio.sxb.·Is value of·W at line 134 of the rbio.sxb LIST embedded in the compiler to set the pins as input?
    ·
    For this purpose, wouldn't the standard code be:

       137  0011  0C0F        MOV W,#$0F        ;  output rb.0
       138  0012  0043        MOV M,W                       
       139  0013  0006        MOV !RB,#%11111111                     
       140  0014  002A        MOV __PARAM1,W                
       141  0015  040A        CLRB __PARAM1.0               
       142  0016  0C1F        MOV W,#$1F                    
       143  0017  0043        MOV M,W                       
       144  0018  020A        MOV !RB,__PARAM1              
            0019  0006
    




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Bad spellers of the world untie!

    Post Edited (mojorizing) : 2/17/2009 4:33:25 AM GMT
Sign In or Register to comment.