SPI with PIC16F887 and Proteus

Status
Not open for further replies.

brunofunchas

Full Member level 3
Joined
Jul 1, 2009
Messages
168
Helped
10
Reputation
20
Reaction score
7
Trophy points
1,298
Location
Portugal
Activity points
2,348
Hello!

I'm trying to communicate with five SN74HC165 IC, by SPI, but the chips to not respond to the PIC18F887!

I have seen the SPI debugger and the microcontroller reads zeros from them. On the oscilloscope I can seen that it first puts low on the SH/LD pin to read the inputs then set it high, then it selects each slave one by one and sends the clock pulses but I can not see any answer.

I'm sampling to fast? Fosc = 8Mhz divided by 4.

Any ideas where the problem is?

Thanks.
 

Attachments

  • TEST.rar
    73.9 KB · Views: 88

Hello!

Thanks for the input! In fact Following your advise I have disconnected all of the outputs and only left the firt IC connected and it work fine. My problem is in fact that I have to daisy chain the five IC's from each output to SER pin of the next IC.

So that:

1: Snapshot of the inputs in all five IC's (IC03 up to IC7): Low on PIN SH/LD
2: Q (PIN09) U3 send the data to SER pin of U4 (PIN 10)

I'm working in daisy chain all the data but I can see the all the bytes but the microcontroller does not see them on the first byte, sometimes is the second, third, and so on...

Attached I have put the new files
 

Attachments

  • TEST_rev0.rar
    46.2 KB · Views: 94

If it were me, I would clear RB1 to a zero at the start of the program and leave it that way. I see no sensible reason to keep disabling the clock, and I wonder whether this might actually be causing spurious clocks.

Hard to be sure without real hardware to test with.

- - - Updated - - -

Now I think harder about it, then all clocks need to be enabled at all times, else how will the data circulate around all shift registers?

Leave all CLK_Inhibit lines low at all times. Ideally tie them low with hardware and use RB1 for some other purpose.
 
Last edited:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…