Ouch. PIC 16F parts do a read-modify-write on the IO port that a pin is on when you use the bsf/bcf instructions, so if you do a bsf PORTA,7 you'll read all of port A, set bit 7 and then write PORTA back out. This means that you could change any of the pins on PORTA depending upon what was read on those lines. A far safer way to do this is to keep a "shadow" register for a port, do the bsf/bcf on that shadow register and when completed write the whole register out to the port. This will guarantee that your bsf/bcf operations don't munge up other bits on the port. Thank goodness the 18F, 30/33/24F parts DON'T have this side effect. DLC OWEN-A wrote: > Using bsf and bcf PORT?,n > Thanking You, > Owen. > > >>I know this is perhaps a bit off topic but I have several boards with >>PIC16F877 processors driving an HC595 shift register and the output >>pins from the pic driving the HC595 are virtually all glitches. >> >>It is hard to pick up a high or low as such on the logic analyser >>other outputs seem ok, has anyone any idea what may be causing this. >> >>And yes I do not like pic's I normally use AVR'S. > > > Perhaps you are having read/modify/write problems, are you using the bit > manipulation instructions? > > Leon > > > > > > Yahoo! Groups Links > > > > > > > > > > > > > > > Yahoo! Groups Links > > > > > > > > -- --------------------------------------- Dennis Clark TTT Enterprises ---------------------------------------
Message
Re: [AVR-Chat] OT HC595 AND PIC GLITCHES
2006-09-07 by Dennis Clark
Attachments
- No local attachments were found for this message.