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.

Strange WPU problem.

Status
Not open for further replies.

2camjohn

Member
When using WPUs on the PIC16f628a I have noticed a strange problem that hasnt occured when using WPUS on any other chip I have tried..



I wire port B pin 6 with a normally open single pole switch to ground.



Once the WPU for that particular pin is enabled the pin reads high as expected.
When the button is pressed, the pin is pulled down and reads as 0.

Here is the strange part, after releasing the button, the pin still reads as 0.

I have to set the individual WPU to high again in the software for it to pull the pin high again.

It is as if pressing the pull down button disables the WPU.



Out of all the PIC devices I have tried, this problem only occurs on the 628a, I have tried several 628a chips and they all behave the same.

The exact same code runs as expected on a pic16f819


I would appreciate any advice the great minds of electro tech can give on this matter.
 

Papabravo

Well-Known Member
A Weak Pullup is exactly that. It may take a while but eventually that weak pullup should return the pin high. Are you absolutley surethat you are not writing to the data latch, or what's worse writing to the TRIS register which is at the same address but in Bank 1? That would certainly explain this behavior.
 

2camjohn

Member
Hi Papabravo, thanks for the input.


I will check through my code thoroughly to be sure what registers are being written. Unfortunately I am writing in a HLL (mstecha hasnt taught me how to program in binary through the paralell port yet). So I will need to read through the compiled instructions to be certain the compiler isnt doing anything I didnt ask it to.

But I am doubtful that is the problem since the test code is very simple and it works fine on other chips.



What strikes me as strange is that pushing the button causes the pullup to stop working.
It doesnt seem to be related to any code that is executed. (the test program just checks the status of the input pin until it changes state)


Unless I alter the code so it makes sure that the pullup is enabled before the input pin is tested(regardless of whether it should already be enabled), in which case all works fine as it does as normal on other chips such as the PIC16f819.
 

Pommie

Well-Known Member
Most Helpful Member
Have you eliminated all other code. Often HLLs will change configurations if you have a peripheral on a port such as an LCD. Can you run the code in the simulator and set a breakpoint before the offending instruction.

Mike.
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top