This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Loading array data serial GPIO

Hi;

I need to send data serially to one GPIO pin to 595 Shift register, I dont want to use SPI. i had written small program to check it with simulator but keil shows error . please check what it is and guide me

#include<LPC21xx.h>

#define Data_Pin (1 << 21)
#define Data_DIR_SET (IO0DIR |= Data_Pin)

#define Clock (1 << 22)
#define Clock_DIR_SET (IO0DIR |= Clock)
#define Clock_SET (IO0SET = Clock)
#define Clock_CLR (IO0CLR = Clock)

#define Latch (1 << 23)
#define Latch_DIR_SET (IO0DIR |= Latch)
#define Latch_SET (IO0SET = Latch)
#define Latch_CLR (IO0CLR = Latch)

int buff[]={0x00,0xff,0xfd};

void shift_595(int buff)
{ Clock_CLR;
Latch_CLR;
Data=buff;
Clock_SET;
Clock_CLR;
} int main(void)
{ int loop;
while(1){
for(loop=0;loop<8;loop++){
shift_595(buff[loop]);
} Latch_SET;
} }

Parents Reply Children
No data