We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I want to use port 2 of 167 on MCB net board for two peripherals, one for keyboard interface and other for lcd interface. Please suggest some code on how to access the same port in parts. regards Rajesh
I would like to know if there is a way to give names to parts of the part. Sure. This is what the MACRO capability of the C Programming Language is useful for. For example:
#define SET_LCD(x) {P2 = (P2 & 0xFF00) | ((x) & 0x00FF);} #define SET_KBD(x) {P2 = (P2 & 0x00FF) | (((x) & 0x00FF) << 8);} #define READ_LCD (P2 & 0x00FF) #define READ_KBD ((P2 & >> 8) & 0x00FF)
Hi Jon Thanks for the suggestion. It has definitely helped me. regards Rajesh