Hi to All
Recently as i was searching to make one project of mine i find a code that could do what i wanted
at first was hard to me to understand what was going on with that code but after some research i found out that this is a method in oder the processor works faster
also i start understand more parts of the code (i am new in coding , just one year through youtube tutorials, some articles in web sites and of course with lot information from here )
My problem is that i want to use the internal pull up resistors for the inputs and i am not sure how to do it with this type of code syntax .
#define Limit_Left_Switch (PINC & B01000000) // PC6, Pin31
(i want to make some tests before i decide to design and produce the Pcb that will have the external pull up resistors )
is this the right method ? :
#define Limit_Left_Switch (PINC & B01000000,INPUT_PULLUP) // PC6, Pin31
Is any other method more appropriate when we are using this kind of syntax ?
Here is the port register code
//***** Limit Switches & LEDs *****
#define LimitPort PORTC // PIN_31, 33, 35, 37 - inputs, PIN_30, 32, 34, 36 - outputs
#define LimitInit() DDRC=B10101010;\
PORTC = B11111111 // PORT_C pullup // external pullup to +5 is desired through 1K resistors PIN_31, 33, 35, 37
#define Limit_Left_LED_On() LimitPort &= ~(1<<7) // PC7, Pin30 0
#define Limit_Left_LED_Off() LimitPort |= (1<<7) // PC7, Pin30 1
#define Limit_Right_LED_On() LimitPort &= ~(1<<5) // PC5, Pin32 0
#define Limit_Right_LED_Off() LimitPort |= (1<<5) // PC5, Pin32 1
#define Limit_Front_LED_On() LimitPort &= ~(1<<3) // PC3, Pin34 0
#define Limit_Front_LED_Off() LimitPort |= (1<<3) // PC3, Pin34 1
#define Limit_Rear_LED_On() LimitPort &= ~(1<<1) // PC1, Pin36 0
#define Limit_Rear_LED_Off() LimitPort |= (1<<1) // PC1, Pin36 1
#define Limit_Left_Switch (PINC & B01000000) // PC6, Pin31
#define Limit_Right_Switch (PINC & B00010000) // PC4, Pin33
#define Limit_Front_Switch (PINC & B00000100) // PC2, Pin35
#define Limit_Rear_Switch (PINC & B00000001) // PC0, Pin37
thanks in advance