Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

16f886 weirdness

Status
Not open for further replies.

Mosaic

Well-Known Member
Hello All:
After 6 hours I am stumped....I can't get PORTB to behave normally. I have whittlerd down my prg to bare basics and still can't solve it.
Here is the code, nothing else is happening.
Code:
banksel ANSEL
	clrf ANSELH
	clrf ANSEL
	banksel TRISA
	clrf TRISB
	clrf TRISA
	bsf TRISB,4
	test;
	clrf STATUS
	clrf PORTB
	bsf PORTB,5; no go, port b5 remains low, seems to behave like an input , scoping the pin picks up noise if nearby pins switch.
	movlw b'00100000'
	movwf PORTB ;no go either ,but triggering PORTB5, B3 and B2  (b'00101100') will allow B5 to set. WHY????!!
	goto $

The circuit is attached, although I don't see any interaction to cause this. I have changed the MCU already, both behave the same and both are new.


Thanks for any thoughts.
 
You are still in bank two... You need to return to Bank one for PORTB banksel PORTB

Sorry actually you are,,, missed the clrf status (this doesn't clear some bits)

This works in ISIS...

Try turning of the comparator module... TIG is on that pin
 
Last edited:
Yeah it works in ISIS.

As for T1G:

I did that as well, cleared T1CON. no change so took it off b4 I posted to keep it simple.

Hard to figure.

I am going to dismantle this circuit board slowly, isolating pin by pin, perhaps there is some type of electrical problem. Just guessing now.

EDIT: Well it was an elec. problem. A short on an RB5 pullup resistor bridging to RB2. But the short was apparently >50ohm which defeated the DMM continuity test, no beep. However it was enough to cause electrical interactions between RB2 & 5 so that unless they were both at the same state an indeterminate result could obtain on both of them.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top