![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
benoitstjean
Joined: 30 Oct 2007 Posts: 553 Location: Ottawa, Ontario, Canada
|
LCD on port B and external interrupt B0 together |
Posted: Wed Dec 05, 2007 1:58 pm |
|
|
Just thought I'd share this info:
I usually use PORT B to drive an LCD display. I have a situation at the moment where I need to use external interrupt on port B0 along with the LCD display. In the LCD.C file provided by PICC compiler, I changed the pinout in the lcd struct to have B0 unused instead of the default (B3 I believe).
Anyhow, the problem I was having was when CCS's LCD driver accessed the LCD display, it would always make B0 an output and stop the external interrupt from responding.
I finally realized that the LCD.C file provided by CCS has one bit on the port that is unused. I changed it to be B0 but didn't realize that the set_tris_b function in the LCD.C file always set that bit to 0, so as output.
Anyhow, changing the bit to a 1 in the LCD.C file solved the problem. I realize it's not a big issue but when you don't think of it, then it's a different story. And if it can be of any help to anyone, then that's great.
Here are my modifications to the original file:
Code: |
#define use_portb_lcd TRUE
struct lcd_pin_map
{ // This structure is overlayed
BOOLEAN unused; // on to an I/O port to gain
BOOLEAN enable; // access to the LCD pins.
BOOLEAN rw; // The bits are allocated from
BOOLEAN rs; // low order up. ENABLE will
int data : 4; // be pin B1.
} lcd;
struct lcd_pin_map const LCD_WRITE = {1,0,0,0,0}; // For write mode all pins are out (except B0 which stays as input)
struct lcd_pin_map const LCD_READ = {1,0,0,0,15}; // For read mode data pins are in (except B0 which stays as input)
|
|
|
![](templates/subSilver/images/spacer.gif) |
ateso3486 Guest
|
Thanks |
Posted: Thu Jan 03, 2008 6:07 pm |
|
|
Thanks you saved my life
I was in your situation. And because of lcd driver, my interrupts only worked for first time. Three days, i was trying to solve this. And this topic, i got the answer. Thanks a lot, benoitstjean. |
|
![](templates/subSilver/images/spacer.gif) |
Gaston
Joined: 05 Nov 2011 Posts: 1 Location: Argentina
|
Excelent post ! |
Posted: Sat Nov 05, 2011 1:42 pm |
|
|
I know this post maybe a little old !.. BUT.. I was finding that info some hours ! Every day Everybody learns something new !
Thanks Bro !
Gaston from Argentina. |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|