Slave PIC to be used like CD4021 chip


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,129

    Default Slave PIC to be used like CD4021 chip

    This is a little weird but, has anyone used a PIC as a slave device like the 4021 PISO (Parallel Input Serial Output)?

    I am trying to use some 4021 as Digital inputs and also get some analog values (8) and all read by the master controller through a Shiftin command.

    The idea is to use a 65 bit buffer, 64 bits for the 8x8bit analog values, and 1 bit for the input of the device, so other can connect on the bus, like another 4021 or another 8 analog input device.

    My main problem is how to shift the 65 bit array (preferably not in assembly...).

    Thanks,
    Ioannis

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    I don't see why it wouldn't work...as long as the PIC was clocked fast enough for you...
    I don't quite see what you're getting at as far as hardware though...
    Are you going to use a large PIC to get 64/65 bits and then shift them out, or the other way around?
    Could you draw up a rough block diagram?

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    I have done what you describe. The "shifting" was done using SEROUT2 and SERIN2. The "master" PIC sent out 4 bytes of data (in my case) and the "slave" took the bytes
    and loaded them into a buffer. The data was followed by a checksum byte. If the checksum matched, the data was written to the port pins. I used a second wire between the two PICs to act as an ACK to indicate a successful trasmission (a pulse LOW was proof that the data got to the slave). The data rate was 19.2 kbaud. Crystals were used on both parts. I used open-collector drive on both lines and 2K pull-ups. The PICs were 6' or so apart.
    Charles Linquist

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    So, this might be something like an 18F8723, grabbing 64 bits worth of digital data from the various ports and funneling it out the serial port? A 64bit, single chip PISO?

  5. #5
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    You apparently are aware of my "chip of choice"!
    Charles Linquist

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Charles Linquis View Post
    You apparently are aware of my "chip of choice"!
    Started off with the 'broken' 8720, moved up along the way as they've came out.
    http://web.ndak.net/jdgrotte/tqfp648...fpadapter.html
    Use it a lot, especially when I need to write 'sloppy' code with a lot of debugging type info. I use the extra pins for LEDs, LCDs, switches, etc.
    Later on, clean up the code, get it down to size and put it on a 40 pin version of the '8723 (i.e. 18F452/4620/4685, whatever). Have a few of a second version that'll allow the '8723 to plug into a 28-pin socket. Same principle applies.
    Very few code changes required as long as I don't use an '8723 specific module or function.

Similar Threads

  1. ShiftOut. Using PIC as Slave device.
    By TonyA in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th March 2010, 19:10
  2. Reading a slave USB with a pic
    By pcaccia in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 25th October 2008, 12:00
  3. Camera with PIC chip
    By The Master in forum Off Topic
    Replies: 5
    Last Post: - 1st July 2008, 14:28
  4. PIC chip resetting. Very weird
    By The Master in forum Off Topic
    Replies: 0
    Last Post: - 28th October 2007, 17:07
  5. Use pic as slave in I2C
    By robert0 in forum General
    Replies: 2
    Last Post: - 3rd February 2006, 19:26

Members who have read this thread : 0

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