Jump to content

Sending a reset pulse on power-up


Axeslinger

Recommended Posts

I'm using a 4017 as a 1-of-3 selector.  My tests indicate that this chip will power up in whatever state it was when power is turned off.  This is not what I need.  I'd like to have the 4017 power up in a state of my choosing, so I'd like to have the PIC16F877 send a pulse to the 4017's reset pin so it starts at digit 0.  My question is:  how long would the pulse have to last to do the job?

Link to comment
Share on other sites

According to the datasheet (http://www.standardproducts.philips.com/products/hef/pdf/hef4017b.pdf) much less than 200 mS (one instruction cycle of the PIC16F877). But take care: when you are generating the pulse by accessign the PORTx register via a read-modify-write instruction like bsf or bcf, you need to add one NOP between these instructions, otherwise the content will be corrupted.

(PIC18F provides LATx registers, where this wait cycle is not required anymore)

Best Regards, Thorsten.

Link to comment
Share on other sites

Well, I sure didn't expect this!

When my PIC powers up and the Init code executes, I have the sequence (per TK)

bsf PORTA,0

nop

bcf PORTA,0

which is intended to send a logic 1 "pulse" through pin RA0 to the reset pin of a 4017 so it is set to a known state upon power-up.

The 4017 resets, which is cool, BUT the PIC is looking like the BCF doesn't execute.  It's not letting go of the pin!  The 4017 "locks up" and refuses to do anything unless I pull the wire off its reset pin.  It works fine then.

Can anyone tell me how to make this "pulse" actually PULSE so the 4017 can go to work?

Thanks!

Link to comment
Share on other sites

The code that Thorsten gave you WILL pulse the A0 pin just as you would expect. How do you have PORTA configured? When the 16F877 powers up PORTA is set for analog input by default. Unless you specically program the port to be digital you will have problems.

Regards,

Synapsys

Link to comment
Share on other sites

Hey, a reply!

I started with the Floorboard, so that was the source for my initial code.  Since that unit was writing program change information to LED digits, PORTA was already configured for output.  I know this to be true, because another chunk of code I changed is turning on 3 LEDs that are connected to RA1, RA2 and RA3.  They aren't supposed to ALL be on and I've been hoping that this is because the 4017 is confused.  There could always be problems with my code, too.

Link to comment
Share on other sites

I'm sure that whatever is going on is not the fault of TK's code snippet.  The advice he's given me so far has been dead right, and the fact that I've been able to get this far is proof of how well this device has been designed and coded.

With that said, though, this power-on reset thing was just an impuse thing I decided to try to do for my convenience.  Resetting the 4017 doesn't HAVE to be done by the PIC.  I found a simple way to implement a power-on reset with discrete components, so I'm going to try that.  I'm hoping that my circuit will work better with the 4017 in full possession of its faculties.  Once I get my primary objective (octaves) in place, I might go back and try P-O-R again.

Link to comment
Share on other sites

I'm going to put this issue on the back burner.  It's more important to get my control mechanisms working properly.  Instead of indicating the octave with individual LEDs, I'll just take advantage of the LED digit tools already provided in the code.  Speaking of code, I...   uhhh...  found some...   uhh...  errors...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...