Hi,
Im trying to get the primer 2 to use an external clock (pin4) as a trigger to read the digital input on a different digital input pin (pin5) . I want to display what is being read on pin5 to verify I am receiving the proper data but so far I only get the letter I with 2 dots on top of it.
//**GPIO initialization sets pin4 and pin5 as digital inputs
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_5;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOC, &GPIO_InitStructure);
unsigned int DOUT_current;
unsigned int DOUT_Data[];
char DOUT_current_str;
int L;
for (L=0; L<8; )
{
while( GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_4) == 1)
{
DOUT_current = GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_5);
DOUT_Data [L] = DOUT_current;
UTIL_uint2str(DOUT_current_str,DOUT_current,1,0);
DRAW_DisplayString(L*10,50,DOUT_current_str,1 );
L++;
}
}
everytime the external clock goes high, I want pin5 to read and store the binary number into DOUT_current and display it on the screen. DOUT_Data[L] is for saving each input. I also left the thrid section of the for loop blank so the loop wont advance until the clock goes high. Either way im sure this code is not very good but regardless the primer2 displays I's. Probably my variable declarations are not right.
~Sam