Output pin problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Output pin problem

664 Views
AntE
Contributor I

Hello, i have a "simple" problem, im setting and clearing an output pin (PTB0) in my program but it doesn´t change, i have changed the output to PTB6 but it neither works (output initialization included), I have other 2 output pins int PTBA and they work well, i dont find the reason of failure... Can anyone help please?

 This is my code:

 

;*** port Init 

        LDA     #$0C    ; PTA0 and PTA1 as input       

        CLR     PTAD    ; PTA2 and PTA3 outputs (this 2 are working)
        STA     PTADD   ;                             
       
        LDA     #$03    ; PTB0 and PTB1 outputs
        CLR     PTBD    ; the rest inputs
        STA     PTBDD   ;    

 

;***port def ***

 

SalFRE EQU    6   ;Out in (PTB0)

 

;*** main ***

 

FRE_DI  BCLR     SalFRE,PTBD    ; 2 ms pulse
           JSR      DLY2
           BSET     SalFRE,PTBD
           RTS

 

;**** Then added a bigger pulse duration to appreciate the change in a LED 

 

FRE_DI  BCLR     SalFRE,PTBD    ; 402 ms total pulse duration
           JSR      DLY100
           JSR      DLY100
           JSR      DLY100
           JSR      DLY100

           JSR      DLY2
           BSET     SalFRE,PTBD
           RTS

Labels (1)
0 Kudos
1 Reply

287 Views
bigmac
Specialist III

Hello,

 

You seem to have defined the SalFRE pin as PTB6 (rather than PTB0), yet PTB6 remains set as an input. This means that the internal output latch for PTB will be updated, but the bit-6 state will not reach the PTB6 pin.

 

Regards,

Mac

 

0 Kudos