HC908QY4 BSET and BCLR inconsistent between POR and RST

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

HC908QY4 BSET and BCLR inconsistent between POR and RST

815 Views
Anonymous
Deactivated User

Hi, i hope this is not a repeat post but my browser crashed.....

I have a pile of HC908QY4 so want to use them for a small project.

But I am noticing some odd behaviour which I suspect is related to BSET and BCLR not working as expected. As far as I can see these command won't function until a force a #0ff and then #00 to the port. Then BCLR and BSET seem to work after POR. But then they appear to not work after a RST.

All is OK if I don't need a RST button! But in this case I do...

The code works after a POR, but doesn't after a manual RST. If I replace BSET and BCLR with OR and AND, it seems to operate OK. But they are handy instructions. I wonder if I need to do something elsewhere to correctly initialise the MCU for these instructions. 

I cannot locate all documents mentioning this - if this was a know snag I would expect it to be documented before now.

It is probably me being dumb, or missing a key initialisation step. My init steps are:

lda #11 ;set COP off and LVI off in CONFIG1
sta $001f
lda #01 ;set CONFIG 2 to enable ext RST
sta $001e

lda #00 ;All inputs for port A
sta $0004 ;DDR A
lda #0ff ;All outputs for port B
sta $0005 ;DDR B

;to make BCLR and BSET functional, I then use this:
lda #0ff
sta portb
lda #00
sta portb

I'd appreciate any insights as to why a RST is behaving differently to a POR, and why I might be experiencing issues with BSET and BCLR.

Many thanks

 

0 Kudos
0 Replies