I am trying to send 8 bits of data out at each rise in the clock.
PIN RC5 is where I am sending the data out serially in the PIC16C63A, and PIN RC3 is my synchronous clock but I am getting very confused.

my goal is to mimic the SPI but not sure if I am doing that here. the confusion comes where I am trying to send the variable slug1 serially (one bit at a time). can anyone help me with this. I am quite new to programming the PIC.


Here is what I have so far.


i VAR BYTE
Flag1 VAR BYTE
Flag2 VAR BYTE
Count_send VAR BYTE
slug1 VAR WORD

slug1 =10110111
clock = 0
char array[8]
TRISC =%00010000

start:
Flag1 = 0 /*Portc pin 1*/
While(Flag1 == 0)
Flag2 = 1 /*PortC pin 2*/

Count_send = 0
Count_send = Count_send + 1

if(Count_send == 1) then

count = 0
PORTB.3 = 0
for (count1 =0; count1 <8; count1++) ; loop 8 times
{
PORTC.3 = 1 ; clock = 1
goto SEND1 ; send a char
PORTC.3 = 0 ; clock = 0
}

if(count = 8)
array[8] = 0

if(Count_send == 1) then
Flag1 = 1
endif

Flag2 = 0
Pause 100
Flag1 = 0
Flag2 = 1
wend





SEND1:

SerOut PORTC.6, T2400, array[count]
count = count + 1
endif
return