Output pin problem

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Output pin problem

1,164件の閲覧回数
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

ラベル(1)
0 件の賞賛
返信
1 返信

787件の閲覧回数
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 件の賞賛
返信