PDA

View Full Version : Clock Out Signal



KeithH
- 27th April 2007, 18:32
My first dabble in PIC programming was to create a Serial circuit with multiple PIC16F84A chips. I chained the PICs together and sent the same Serial Out data to every chip. I was able to light up any LED on PortA of any slave chip from one driver PIC using serout/serin.

I am now trying to send data to a bunch of 74HC4094 Shift registers instead.

I have not written any code as yet as I am trying to work out which pins to connect. the only one I am not sure about is how I get a clock signal from the PIC16F84A chip to provide the CK clock for the shift register. I have heared mention of using RA3 which has a real time clock connection or RA6 as it is used for serial programming (of the PIC I think though) or do i connect to the ClockOUT OCS2 pin as this is being used by my 4Mhz crystal....

Any ideas. Thanks in advance.

skimask
- 27th April 2007, 18:41
My first dabble in PIC programming was to create a Serial circuit with multiple PIC16F84A chips. I chained the PICs together and sent the same Serial Out data to every chip. I was able to light up any LED on PortA of any slave chip from one driver PIC using serout/serin.

I am now trying to send data to a bunch of 74HC4094 Shift registers instead.

I have not written any code as yet as I am trying to work out which pins to connect. the only one I am not sure about is how I get a clock signal from the PIC16F84A chip to provide the CK clock for the shift register. I have heared mention of using RA3 which has a real time clock connection or RA6 as it is used for serial programming (of the PIC I think though) or do i connect to the ClockOUT OCS2 pin as this is being used by my 4Mhz crystal....

Any ideas. Thanks in advance.

If you use OSC2 as an output, you won't have any control over it. It'll just run and run and run whether or not you've got data to shift or not.
Use SHIFTOUT. That way you can define both your clock and your data pin and have complete control over what they do, when they do it, and how they do it, and you can latch and enable the outputs with seperate pins on top of that. See the green book - section 5.76

KeithH
- 28th April 2007, 17:01
Use SHIFTOUT........ See the green book - section 5.76

It seems my green book is infact a light blue book.... so I don not have a section 5.76 nor the SHIFTOUT function. I only have SEROUT.

Has any one been able to drive a shift register (e.g. 74HC4094) from tha PIC chip using PicBasic? i.e. not PicBasic Pro?

I am not opposed to using Assembler or a.n.other compiler if needed, though I guess it is not something I can ask for recommendations here? I can't afford the extra £130 to get the pro compiler, even assuming I could trade it in that is. I wouldn't even know if I could get something to work with my EPIC programmer.

dhouston
- 28th April 2007, 17:40
MELabs has sample programs on their website for both PBP and PB.http://www.melabs.com/resources/samples.htmThere's one for ShiftIn/ShiftOut with PicBasic.http://www.melabs.com/resources/samples/pbc/shift.bas

KeithH
- 30th April 2007, 15:37
Thanks Dave and SKIMASK for your help. Things that may seem obvious once you know they are there are not easy to find without a little help.

I had already looked at shift.bas but wast not sure if shiftout was the correct method to start with.

Will there be much of an overhead using the shift.bas Shiftout function over the SHIFTOUT function in PBP?

dhouston
- 30th April 2007, 15:48
Will there be much of an overhead using the shift.bas Shiftout function over the SHIFTOUT function in PBP?I've never tried to compare them in this way but my guess would be that PBP is slightly more efficient. However, this is a pretty simple operation so I doubt there's a huge difference. The real question is whether it, along with your other code, fits in the memory available.

skimask
- 30th April 2007, 15:49
I had already looked at shift.bas but wast not sure if shiftout was the correct method to start with.
Will there be much of an overhead using the shift.bas Shiftout function over the SHIFTOUT function in PBP?

I'd be willing to bet that the compiled SHIFTOUT command looks very similar to the shift.bas program, from a functional standpoint anyways (probably won't have the same labels, jumps, etc., but the flow would be almost identical).
As far as overhead goes, yes, there's overhead. 'cause when you're doing the shiftout, that's all your doing, is shifting out. You can't do anything else (unless you've got interrupts going for you).

KeithH
- 3rd May 2007, 23:28
I've managed to get the shift.bas working with the PIC16F84A sending a binary count to a 74HC4094 Shift register.

I've had to do this with five wires: Ground, Vcc(5V), Strobe, Clock and Data. I have set the Output Enable permanetly on so I do not need it wired.
It is a shame I need so many wires but there we go, I only needed three wires to make two pics communicate.

I have placed LEDs on the Shift register's Parallel out pins along with a current limiting 680R resistor on each pin.

I am intending to create a chain of 30 or more shift registers so don't want to loose too much power over the whole chain.

I am not too hot on the electical side of this so for me this will be trial and error. I can't really say exactly what I am trying to make except to say it will have a lot of LEDs on a chain of shift registers, all spaced about an inch apart and wired together, i.e. not on the same PCB. So there is a lot of room for leakage and noise etc.

Is it a good idea to use the Resistors or should I look for a register/LED combination that draws the least power per LED?

Also it would make it easier to build if I didn't need the 210+ resistors.

Any suggestions would be appreciated.

Thanks.

skimask
- 4th May 2007, 01:35
I have placed LEDs on the Shift register's Parallel out pins along with a current limiting 680R resistor on each pin. I am intending to create a chain of 30 or more shift registers so don't want to loose too much power over the whole chain. I am not too hot on the electical side of this so for me this will be trial and error. I can't really say exactly what I am trying to make except to say it will have a lot of LEDs on a chain of shift registers, all spaced about an inch apart and wired together, i.e. not on the same PCB. So there is a lot of room for leakage and noise etc. Is it a good idea to use the Resistors or should I look for a register/LED combination that draws the least power per LED? Also it would make it easier to build if I didn't need the 210+ resistors. Any suggestions would be appreciated.

Thanks.

Since your LEDs are individually controllable, you're probably going to need one resistor per LED, unless you find LEDs with resistors built in. If you don't, you might end up burning up '4094's over time. Maybe there's another version of the '4094' out there that can handle the current your LEDs require.