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 CCS Technical Support

Best way of splitting LCD pins between ports?

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



Joined: 26 Feb 2004
Posts: 11

View user's profile Send private message

Best way of splitting LCD pins between ports?
PostPosted: Mon Mar 29, 2004 10:01 am     Reply with quote

Hi all,

Quick qn., the LCD driver that ships with PICC uses a contiguous port to control the display. The code maps a struct over the the port like this:

Code:
// As defined in the following structure the pin connection is as follows:
//      PORT_D_PIN   LCD_Fn   LCD_PIN#
//         D0       Enable      6
//           D1       RS         4
//           D2       R/W         5
//           D4       DB4         11
//           D5       DB5         12
//           D6       DB6         13
//           D7       DB7         14
//
//   LCD pins DB0-DB3 are not used and PORT_D_PIN 3 is not used.


struct lcd_pin_map {                // This structure is overlayed
           BOOLEAN enable;         // on to the I/O port to gain
           BOOLEAN rs;              // access to the LCD pins.
           BOOLEAN rw;              // The bits are allocated from
           BOOLEAN unused;          // low order up.  ENABLE will
           int     data : 4;        // be pin D0.
        } lcd;


#byte lcd = 8                  // This puts the entire structure
                           // on to port D (at address 8)
#define set_tris_lcd(x) set_tris_d(x)

#define lcd_type 2           // 0=5x7, 1=5x10, 2=2 lines
#define lcd_line_two 0x40    // LCD RAM address for the second line

BYTE const LCD_INIT_STRING[4] = {0x20 | (lcd_type << 2), 0xc, 1, 6};
                             // These bytes need to be sent to the LCD
                             // to start it up.


                             // The following are used for setting
                             // the I/O port direction register.

struct lcd_pin_map const LCD_WRITE = {0,0,0,0,0}; // For write mode all pins are out
struct lcd_pin_map const LCD_READ = {0,0,0,0,15}; // For read mode data pins are in

This all works fine, but I don't have an entire contiguous port available on my design, I need to split the pins between two ports. What is the best way to accomplish this?

Thanks.
GDetienne



Joined: 20 Sep 2003
Posts: 47
Location: Brussel - Belgium

View user's profile Send private message

LCD drivers
PostPosted: Mon Mar 29, 2004 10:19 am     Reply with quote

Try the driver found at this addresse : http://www.vermontficks.org/lcdd.htm
It work fine and is easy to adapt at your PIC configuration.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Mar 29, 2004 12:39 pm     Reply with quote

Also see this post by Mark:
http://www.ccsinfo.com/forum/viewtopic.php?t=17323
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