Skip to main content
Visitor II
February 10, 2010
Question

Using BSET BRES on IO-PORT

  • February 10, 2010
  • 4 replies
  • 1056 views
Posted on February 10, 2010 at 05:44

Hi

Can BSET and BRES instructions be used on an IO-PORT like

BSET     PADR,&sharp1

to turn an output on

or do you have to do

LD         A,PADR

OR         A,&sharp1

LD         PADR,A

TIA

#ioport #ioport #ioport
    This topic has been closed for replies.

    4 replies

    Visitor II
    February 11, 2010
    Posted on February 11, 2010 at 12:21

    Yes. BSET and BRES  are simplest.

    Visitor II
    February 11, 2010
    Posted on February 11, 2010 at 14:45

    Visitor II
    February 11, 2010
    Posted on February 11, 2010 at 14:49

    Suppose you mean:

     

     

    BSET     PADR,#0

     

    -with-

    LD         A,PADR

    OR         A,#1

    LD         PADR,A

    Regards,

    WoRo
    Visitor II
    February 17, 2010
    Posted on February 17, 2010 at 18:48

    Be careful though.  At least on the F324, check the datasheet section 9.2.1 Note 3:  Do not use read/modify/write instructions (BSET or BRES) to modify the DR register as this might corrupt the DR content for I/Os configured as input.