CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

LCD on port B and external interrupt B0 together

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
benoitstjean



Joined: 30 Oct 2007
Posts: 553
Location: Ottawa, Ontario, Canada

View user's profile Send private message

LCD on port B and external interrupt B0 together
PostPosted: Wed Dec 05, 2007 1:58 pm     Reply with quote

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)
ateso3486
Guest







Thanks
PostPosted: Thu Jan 03, 2008 6:07 pm     Reply with quote

Thanks you saved my life Smile
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.
Gaston



Joined: 05 Nov 2011
Posts: 1
Location: Argentina

View user's profile Send private message

Excelent post !
PostPosted: Sat Nov 05, 2011 1:42 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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