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

ps2

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



Joined: 05 Jan 2006
Posts: 105

View user's profile Send private message

ps2
PostPosted: Sun Dec 17, 2006 6:29 am     Reply with quote

hi all;

according to the following link:
http://www.ccsinfo.com/forum/viewtopic.php?t=25673&highlight=ps2

i try to use this new library,,when i add an lcd library "lcd_kbd1.c" its make an error!! while "lcd.c" don't!! why?
here is my lcd_kbd1 library:
Code:


#include <jonsinc.h>
#use delay(clock=20000000)

// These defines are specifically for a 4x16 line display.
#define LINE_16_1          0x00
#define LINE_16_2          0x40
#define LINE_16_3          0x10
#define LINE_16_4          0x50
// These defines are specifically for a 4x20 line display.
#define LINE_20_1          0x00
#define LINE_20_2          0x40
#define LINE_20_3          0x14
#define LINE_20_4          0x54
// Another define for use in LCD_PutCmd
#define CLEAR_DISP      0x01
// This is a macro used in the subroutines below */
#define     PULSE_EN        EN = 1; delay_us ( 10 ); EN = 0; delay_ms ( 5 )
#byte   port_e  =   9           /* set variable that maps to memory */
#byte   PORT_A  =   5           /* set variable that maps to memory */
#byte   port_b=   6
#byte   PORT_D=   8


#byte   DATA = PORT_A
#bit    RS = port_e.0
#bit    EN = port_e.1
char kbd_getc(void);
char getkey ( void );

// These are prototype statements.
void LCD_SetPosition ( char cX );
void LCD_PutChar ( char cX );
void LCD_PutCmd ( char cX );
void LCD_Init ( void );

// These are the display subroutines.==============================

void LCD_Init ( void )
    {
    // Initializing into 4-bit mode is a very exact sequence
    // as defined in the datasheets for these displays.
    set_tris_a ( 0x00 );        /* outputs */
    set_tris_b ( 0xFC );        /* Bits 0 & 1 are outputs */
    set_tris_e ( 0xF0 );
    DATA = 0x00;
    delay_ms ( 200 );       /* wait enough time after Vdd rise */
    RS =0;
    DATA = 0x03;            /* init with specific nibbles to start 4-bit mode */
    PULSE_EN;
    PULSE_EN;
    PULSE_EN;
    DATA = 0x02;            /* set 4-bit interface */
    PULSE_EN;               /* send dual nibbles hereafter, MSN first */
    LCD_PutCmd ( 0x2C );    /* function set (2 lines, 5x7 characters) */
    LCD_PutCmd ( 0x0E );    /* display ON, cursor on, no blink */
    LCD_PutCmd ( 0x01 );    /* clear display */
    LCD_PutCmd ( 0x06 );    /* entry mode set, increment */
    }

void LCD_SetPosition ( cX )
    {
    /*
    This subroutine works specifically for 4-bit Port A.
    Value received cX will place cursor at a particular line and offset.
                   16-char display   20-char display
                   ===============   ===============
    Line 1 is hex:     00 - 0F           00 - 13
    Line 2 is hex:     40 - 4F           40 - 53
    Line 3 is hex:     10 - 1F           14 - 27
    Line 4 is hex:     50 - 5F           54 - 67
    */
    DATA = swap ( cX ) | 0x08;
    PULSE_EN;
    DATA = swap ( cX );
    PULSE_EN;
    }

void LCD_PutChar ( cX )
    {
    /* this subroutine works specifically for 4-bit Port A */
    RS = 1;
    DATA = swap ( cX );     /* send high nibble */
    PULSE_EN;
    DATA = swap ( cX );     /* send low nibble */
    PULSE_EN;
    RS = 0;
    }

void LCD_PutCmd ( cX )
    {
    /* this subroutine works specifically for 4-bit Port A */
    DATA = swap ( cX );     /* send high nibble */
    PULSE_EN;
    DATA = swap ( cX );     /* send low nibble */
    PULSE_EN;
    }

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//----------------------------------------------------------------------------


Code:

/* Include this file by inserting the line "#include <jonsinc.h>" at
the beginning of the C source code.  Or, if you prefer, you can embed it's
contents at the end of each of your 12C509H, 16F84H, 16F874.H, etc. files.*/

#case

#ifndef TRUE
#define TRUE 1
#endif

#ifndef FALSE
#define FALSE 0
#endif

#ifndef YES
#define YES 1
#endif

#ifndef NO
#define NO 0
#endif

#ifndef HIGH
#define HIGH 1
#endif

#ifndef LOW
#define LOW 0
#endif

#ifndef ON
#define ON 1
#endif

#ifndef OFF
#define OFF 0
#endif

#ifndef UP
#define UP 1
#endif

#ifndef DOWN
#define DOWN 0
#endif

#ifndef UCHAR
#define UCHAR char
#endif

#ifndef UINT
#define UINT long
#endif

#ifndef BIT
#define BIT short
#endif

#ifndef SCHAR
#define SCHAR signed int
#endif

#ifndef SINT
#define SINT signed long
#endif

#ifndef FLOAT
#define FLOAT float
#endif

so...
hadeelqasaimeh



Joined: 05 Jan 2006
Posts: 105

View user's profile Send private message

PostPosted: Sun Dec 17, 2006 7:09 am     Reply with quote

i face the same proplem.

http://www.ccsinfo.com/forum/viewtopic.php?t=27544

when add a lcd library ,,give me errors.
thanx
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sun Dec 17, 2006 7:40 am     Reply with quote

What is the error message you get?
Which compiler version are you using?

Code:
#use delay(clock=20000000)
Don't put this line here, have it in the same file where the #fuses line is. Now you are runing the risk of declaring the clock speed twice with unknown results.
hadeelqasaimeh



Joined: 05 Jan 2006
Posts: 105

View user's profile Send private message

PostPosted: Mon Dec 18, 2006 10:01 am     Reply with quote

it give this message
Code:

undefined identifier PS2KEY_BUF_SIZE

my compiler is 3.249
hadeelqasaimeh



Joined: 05 Jan 2006
Posts: 105

View user's profile Send private message

PostPosted: Thu Dec 21, 2006 1:22 am     Reply with quote

helllllooo!!!
nobody can help?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Dec 21, 2006 1:37 am     Reply with quote

Quote:

it give this message,
undefined identifier PS2KEY_BUF_SIZE


Notice that in your code, you have this statement:
Code:
#case


Notice that in John Leung's code, he spells that constant name
two different ways. He doesn't use the #case statement in his
code, so he doesn't get an error.
Code:

PS2Key_BUF_SIZE

PS2KEY_BUF_SIZE
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