Axeslinger Posted October 17, 2005 Report Share Posted October 17, 2005 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? Quote Link to comment Share on other sites More sharing options...
TK. Posted October 17, 2005 Report Share Posted October 17, 2005 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. Quote Link to comment Share on other sites More sharing options...
Axeslinger Posted October 17, 2005 Author Report Share Posted October 17, 2005 So if I were going to use RA0 to send my pulse, I would set PORTA to 0x01, do a NOP, then set PORTA to 0x00? Easy enough! Quote Link to comment Share on other sites More sharing options...
TK. Posted October 17, 2005 Report Share Posted October 17, 2005 Better to write: bsf PORTA, 0 nop bcf PORTA, 0This only touches the first bit, and you don't need to take care about the other ones (bit operations are the big strength of microcontrollers)Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
Axeslinger Posted October 17, 2005 Author Report Share Posted October 17, 2005 Let's see if I can get this right:Â GRUSS, HERR KLOSE! Quote Link to comment Share on other sites More sharing options...
Axeslinger Posted October 19, 2005 Author Report Share Posted October 19, 2005 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,0nopbcf PORTA,0which 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! Quote Link to comment Share on other sites More sharing options...
Synapsys Posted October 19, 2005 Report Share Posted October 19, 2005 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 Quote Link to comment Share on other sites More sharing options...
Axeslinger Posted October 19, 2005 Author Report Share Posted October 19, 2005 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. Quote Link to comment Share on other sites More sharing options...
Axeslinger Posted October 19, 2005 Author Report Share Posted October 19, 2005 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. Quote Link to comment Share on other sites More sharing options...
Davo Posted October 20, 2005 Report Share Posted October 20, 2005 Why not use a reset generator IC such as the TL7705ACP? These cost maybe forty cents apiece and are more reliable than building one from discretes. Quote Link to comment Share on other sites More sharing options...
Axeslinger Posted October 20, 2005 Author Report Share Posted October 20, 2005 Why not use a reset generator IC such as the TL7705ACP? These cost maybe forty cents apiece and are more reliable than building one from discretes.Uhhh... because I didn't know such things existed?!?!?!?!  ??? ??? ??? ??? Quote Link to comment Share on other sites More sharing options...
Axeslinger Posted October 20, 2005 Author Report Share Posted October 20, 2005 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... Quote Link to comment Share on other sites More sharing options...
Axeslinger Posted October 24, 2005 Author Report Share Posted October 24, 2005 I won't need to reset a 4017 because I'm not going to use one. My state change methodology is going to be implemented in software. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.