Clock Out Signal


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 2007
    Location
    UK
    Posts
    5

    Default Clock Out Signal

    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.

  2. #2
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by KeithH View Post
    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
    Last edited by skimask; - 27th April 2007 at 17:45.

  3. #3
    Join Date
    Apr 2007
    Location
    UK
    Posts
    5

    Default

    Quote Originally Posted by skimask View Post
    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.

  4. #4
    Join Date
    Dec 2005
    Posts
    1,073

    Default

    MELabs has sample programs on their website for both PBP and PB.There's one for ShiftIn/ShiftOut with PicBasic.

  5. #5
    Join Date
    Apr 2007
    Location
    UK
    Posts
    5

    Default Thanks

    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?

  6. #6
    Join Date
    Dec 2005
    Posts
    1,073

    Default

    Quote Originally Posted by KeithH View Post
    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.

  7. #7
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by KeithH View Post
    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).

  8. #8
    Join Date
    Apr 2007
    Location
    UK
    Posts
    5

    Smile All working now

    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.

  9. #9
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by KeithH View Post
    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.

Similar Threads

  1. EM4095 Chip, get Clock and Data signals?
    By mindthomas in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 19th August 2008, 06:27
  2. PIC16F684 + LCD to use the 256bytes of EEPROM - HELP
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th March 2008, 14:19
  3. After Shiftout where is the clock signal???
    By makson in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 31st August 2007, 18:27
  4. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  5. Wiring for a clock signal
    By champion in forum General
    Replies: 2
    Last Post: - 15th January 2007, 22:15

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts