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 CCS Technical Support

Communication routine with Register shifter!

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



Joined: 21 Mar 2020
Posts: 4
Location: jose soares n 625

View user's profile Send private message Send e-mail

Communication routine with Register shifter!
PostPosted: Sat Mar 21, 2020 3:31 pm     Reply with quote

People will gradually make available a code on how to control the shift
register 595, I know it is a subject to discuss and very interesting! beauty?
Code:

void update_shift (unsigned int32 dado)
{
unsigned int32 aux=0x80000000;  // defines and initializes the variable
unsigned char aux1;

for (aux1=0;aux1<=31;aux1++)
{
  if(dado & aux);  // checks if the bit is at 1
    output_high(data);  // prints the date
  else
  output_low(data);  // reset the data
 
aux=auxe/2 //
rotates 1 bite to the right

delay_us(10);

output_high(clock);
output_low(clock);//
generates clock pulse

I will post the complete code if someone explain to me about this code 0x80000000. It is hexadecimal. It seems that when they put this type of code the microcontroller os can be recorded 1 only time otherwise I am mistaken dynamic memory I am not well remembered!
Thanks Wink
_________________
charles Frances R.cavalcanti


Last edited by Tthe aprendiz on Sun Mar 22, 2020 6:29 pm; edited 1 time in total
temtronic



Joined: 01 Jul 2010
Posts: 9229
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Mar 21, 2020 6:35 pm     Reply with quote

There are typo errors in the code...
CCS supplies working shift functions, both left and right..
data type 'char' IS unsigned 8 bit ....
variable 'data' isn't defined....
Tthe aprendiz



Joined: 21 Mar 2020
Posts: 4
Location: jose soares n 625

View user's profile Send private message Send e-mail

PostPosted: Sun Mar 22, 2020 6:20 pm     Reply with quote

temtronic wrote:
There are typo errors in the code...
CCS supplies working shift functions, both left and right..
data type 'char' IS unsigned 8 bit ....
variable 'data' isn't defined....


temtronic
You're right, sorry was a little detail, however it was done purposely to see if anyone, some "Jedi" lol ha ha ha
would show up here!

Thanks for replying ! Is as follows defining the micro controller and the fuses would look like this,
Code:

#include <18f452.h>
#fuses hs,nolvp,nowdt
#use delay (clock=10000000)
#define 11 pin_a1
#define 12 pin_a2
#define 13 pin_a3
#define 14 pin_a5
#define date pin_c0
#define clock pin_c1
#define lat pin_c2


Cool Wink
_________________
charles Frances R.cavalcanti
temtronic



Joined: 01 Jul 2010
Posts: 9229
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Mar 22, 2020 8:02 pm     Reply with quote

BTW CCS supplies a '595' driver....
Ttelmah



Joined: 11 Mar 2010
Posts: 19517

View user's profile Send private message

PostPosted: Mon Mar 23, 2020 2:02 am     Reply with quote

Also aux is not defined, so after one loop the contents of aux become
indeterminate. May be what is actually causing the problem....
Tthe aprendiz



Joined: 21 Mar 2020
Posts: 4
Location: jose soares n 625

View user's profile Send private message Send e-mail

PostPosted: Wed Mar 25, 2020 12:53 pm     Reply with quote

Ttelmah wrote:
Also aux is not defined, so after one loop the contents of aux become
indeterminate. May be what is actually causing the problem....


Code:
aux defined in unsigned aux = 0x80000000
ok???
_________________
charles Frances R.cavalcanti
Tthe aprendiz



Joined: 21 Mar 2020
Posts: 4
Location: jose soares n 625

View user's profile Send private message Send e-mail

PostPosted: Wed Mar 25, 2020 12:57 pm     Reply with quote

temtronic wrote:
BTW CCS supplies a '595' driver....


These libraries are difficult for those who do not have a code and making your own code would be better.
_________________
charles Frances R.cavalcanti
Ttelmah



Joined: 11 Mar 2010
Posts: 19517

View user's profile Send private message

PostPosted: Thu Mar 26, 2020 3:55 am     Reply with quote

Tthe aprendiz wrote:
Ttelmah wrote:
Also aux is not defined, so after one loop the contents of aux become
indeterminate. May be what is actually causing the problem....


Code:
aux defined in unsigned aux = 0x80000000
ok???


Actually it is auxe that is missing....
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