matise
Newbie level 4
- Joined
- Nov 15, 2012
- Messages
- 5
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,321
I need to send a series of bits, one at at time throu GPIOc port c6-c9.
I will show you the part of code that is intresting here.
I will use this ports:
PC9 - W_CLK
PC8 - FQ_UD
PC7 - DATA
PC6 - RESET
I use push pull and speed 2 MHz.
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
And this is the bits i will send throu PortC7 from right to left:
char frequency = 0x0A3D70A4; // 5MHz
Here is part of the code for sending data out PC7:
And later:
frequency>>=1; // shift one bit...
A simple code but there is no signal out.
Nothing comes out from port C7.
So what is it i do wrong here?
What is it i dont understand?
Do i need some other Mode out?
Or maybe i cant use WriteBit this way?
Someone have a clue about this?
I will show you the part of code that is intresting here.
I will use this ports:
PC9 - W_CLK
PC8 - FQ_UD
PC7 - DATA
PC6 - RESET
I use push pull and speed 2 MHz.
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
And this is the bits i will send throu PortC7 from right to left:
char frequency = 0x0A3D70A4; // 5MHz
Here is part of the code for sending data out PC7:
Code dot - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 for (n=0; n<32; n++) { frequency & 0x1 == 1; if ((frequency & 0x1) == 1) // set data pin (2) to 1 or 0 { GPIO_WriteBit(GPIOC, GPIO_Pin_7, Bit_SET); // set data pin (2) to 1 } else { GPIO_WriteBit(GPIOC, GPIO_Pin_7, Bit_RESET); // set data pin (2) to 0 }
And later:
frequency>>=1; // shift one bit...
A simple code but there is no signal out.
Nothing comes out from port C7.
So what is it i do wrong here?
What is it i dont understand?
Do i need some other Mode out?
Or maybe i cant use WriteBit this way?
Someone have a clue about this?
Last edited by a moderator: