CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

74hc595 + pic18f4620 + enc28j60, 74hc595 dont work

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
OpenSys



Joined: 15 Oct 2010
Posts: 19

View user's profile Send private message

74hc595 + pic18f4620 + enc28j60, 74hc595 dont work
PostPosted: Tue Oct 26, 2010 3:06 pm     Reply with quote

hello,

I have problems to get the 74hc595 working.
I have the pic18f4620 + enc28j60 working good, but im unable to put the 74hc595 working.

Question:
Can I use the CLK and SDO of the pic to connect to 74hc595 ?
I question this because this data lines was already connected to the enc28j60.

I have the storage register clock (ST_CP) connected to pin 21, D2 on pic but in 74595.c include file I don't see any code to send the data to 74hc595 pin.

ex:
Code:

#define EXP_OUT_ENABLE  PIN_D3 //pin 22
#define EXP_OUT_CLOCK   PIN_C3 // pin18
#define EXP_OUT_DO      PIN_C5 //pin 24
#define NUMBER_OF_74595 1

I have the pin 13 OE of 74hc595 to the ground Smile
One thing that appends is, if I pass my fingers on pic over close the 21 pin all the led connect to the 74hc595 will blink... strange thing.

I see all the examples in the forum about it, but I'm unable to find to solution on it.

A help will be good appreciated.

Thanks,

VS
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Oct 26, 2010 4:08 pm     Reply with quote

Here are the connections required by the 74595.c driver:
Code:

Signal name on PIC   74HC595 pin
EXP_OUT_ENABLE       ST_CP
EXP_OUT_DO           DS
EXP_OUT_CLOCK        SH_SP

Other signals
+5v                  /MR
Ground               /OE

You don't need to use the hardware SPI pins. The 74595.c driver
uses "bit banging" to send the data. It does not use hardware SPI.

Also, the 74595.c driver routine expects a pointer to the data.
This sample code shows how to call the driver routine if you have
a single byte variable (for just 1 74hc595), or if you have an array
of data (for several 74hc595's).
Code:

void main(void)
{
int8 value;
int8 array[3] = {0x27, 0x45, 0x13};

// How to send a single byte variable to the 74595 driver:
value = 0x55;
write_expanded_outputs(&value);

// How to send an array to the 74595 driver:
write_expanded_outputs(array);


while(1);
}
OpenSys



Joined: 15 Oct 2010
Posts: 19

View user's profile Send private message

PostPosted: Wed Oct 27, 2010 6:32 am     Reply with quote

PCM programmer wrote:
Here are the connections required by the 74595.c driver:
Code:

Signal name on PIC   74HC595 pin
EXP_OUT_ENABLE       ST_CP
EXP_OUT_DO           DS
EXP_OUT_CLOCK        SH_SP

Other signals
+5v                  /MR
Ground               /OE

You don't need to use the hardware SPI pins. The 74595.c driver
uses "bit banging" to send the data. It does not use hardware SPI.

Also, the 74595.c driver routine expects a pointer to the data.
This sample code shows how to call the driver routine if you have
a single byte variable (for just 1 74hc595), or if you have an array
of data (for several 74hc595's).
Code:

void main(void)
{
int8 value;
int8 array[3] = {0x27, 0x45, 0x13};

// How to send a single byte variable to the 74595 driver:
value = 0x55;
write_expanded_outputs(&value);

// How to send an array to the 74595 driver:
write_expanded_outputs(array);


while(1);
}


thank you for answer-me.

my pins outs is ok now, i miss the PIN_D2 is set it in error PIN_D3 in ST_CP.

One answer that you don't answer-me is can i use the SDO and CLK at same time for two devices ?


i just put:

value = 0x01;
write_expanded_outputs(&value);

one led nÂș2 is turn on, but if i change the hex 01 don't have any led on, and in other hex's codes have garbage in lcd, ethernet module dont init, pic reset, etc...

can you show a example of the correct hex codes to 74hc595 ?

Regards,

VS
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group