cancel
Showing results for 
Search instead for 
Did you mean: 

How do I assign a TUS

kemal
Associate II
Posted on January 18, 2015 at 21:19

hi

How do I assign a TUS variable cont

TUS = cont;      How do I ?

thanks

#include <stm32f10x.h>

#include <stm32f10x_conf.h>

#include <stm32f10x_rcc.h>

#include <stm32f10x_gpio.h>

#define  PORT     GPIOB

#define   TUS       GPIO_Pin_1

char cont;

int main(void)

      

        {

        RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);

        GPIO_StructInit(&GPIO_InitStructure);

        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1  ;

        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;

        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;

        GPIO_Init(PORT, &GPIO_InitStructure);

//    

TUS = cont;

//

            }
2 REPLIES 2
Posted on January 18, 2015 at 22:07

Awkwardly posed...

Writing

GPIO_SetBits(GPIOB, GPIO_Pin_1);

GPIO_ResetBits(GPIOB, GPIO_Pin_1);

GPIO_WriteBit(GPIOB, GPIO_Pin_1, state);

GPIOB->ODR = (GPIOB->ODR & ~GPIO_Pin_1) | (state ? GPIO_Pin_1 : 0);

Reading

state = GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_3);

state = GPIOC->IDR & GPIO_Pin_3;

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
kemal
Associate II
Posted on January 18, 2015 at 22:19

Thank you