Output pin problem

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Output pin problem

1,165 次查看
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 回复

788 次查看
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 项奖励
回复