View previous topic :: View next topic |
Author |
Message |
Tthe aprendiz
Joined: 21 Mar 2020 Posts: 4 Location: jose soares n 625
|
Communication routine with Register shifter! |
Posted: Sat Mar 21, 2020 3:31 pm |
|
|
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 _________________ 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: 9228 Location: Greensville,Ontario
|
|
Posted: Sat Mar 21, 2020 6:35 pm |
|
|
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
|
|
Posted: Sun Mar 22, 2020 6:20 pm |
|
|
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
| _________________ charles Frances R.cavalcanti |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9228 Location: Greensville,Ontario
|
|
Posted: Sun Mar 22, 2020 8:02 pm |
|
|
BTW CCS supplies a '595' driver.... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19516
|
|
Posted: Mon Mar 23, 2020 2:02 am |
|
|
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
|
|
Posted: Wed Mar 25, 2020 12:53 pm |
|
|
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
|
|
Posted: Wed Mar 25, 2020 12:57 pm |
|
|
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: 19516
|
|
Posted: Thu Mar 26, 2020 3:55 am |
|
|
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.... |
|
|
|