Software conrolled Port_x_7 usage while LCD user module using Port_x
Anonymous
Not applicable
Jan 04, 2011
04:39 AM
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Jan 04, 2011
04:39 AM
Question: Why Pin7 of Port2 always being drived to low even I pull it high in my code if LCD user module using Port2?
Answer:
It is not recommended to use the port assigned to LCD for any other applications. However, if you want to use the pin 7 of port x which used by LCD user module, you need to update pin Px.7, please update Port_x_Data_SHADE variable by setting or clearing the 7th bit (depending what you want to do) and later copy the variable content to PRTxDR, a simple example as below:
//declare this before main.
extern BYTE Port_x_Data_SHADE;
//update the shadow register before writing to port.
Port_x_Data_SHADE ^= 0x80;
PRTxDR ^= Port_x_Data_SHADE;
Also, it would be a good idea to move the software controlled pin to another port and use Px7 as a global input or output if demanded.
Labels
Rate this article:
Contributors
-
This widget could not be displayed.Anonymous