View previous topic :: View next topic |
Author |
Message |
wb9ixs
Joined: 02 Mar 2014 Posts: 1 Location: Wales, WI
|
Built in library help |
Posted: Sun Jan 14, 2018 6:49 am |
|
|
Hello,
I am new to the CCS C IDE I have been using MikroC Pro for several years. I am having some trouble finding the details regarding the built in libraries for the CCS C. For example I was going to experiment with a LCD and found an example on the internet and in that article they explained how the different LCD commands worked. No where in the CCS C reference manual did I find the matching explanations. So I have come to the conclusion that I don't no where to look. Here is an example of what I found in the article:
lcd_putc(c)
This function will display c on the next cursor position of the LCD. You can print strings and characters using this function. You can also use following backslash character constants for sending different commands to LCD.
\\a – To set cursor to the upper left
\\f – To clear display and set cursor to upper left
\\n – To go to start of next line
\\b – To move back one position
Has anyone found anything like this in any CCS C reference material?
Thanks |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Sun Jan 14, 2018 7:08 am |
|
|
OK, I have an older version of the compiler and lcd_putc() is NOT a CCS listed function. It's actually part of an LCD driver. Usually 'drivers' will have comments or explanations buried within them. Drivers can be simple or complicated and there's probably 1,000 different drivers for text based LCD modules. The more complicated the driver, the more space it'll take up so if you don't use 80% of a driver, normally you'll delete that code to save space.
As for the LCD commands you refer to, they can be 'generic' or common to _most_ LCD modules BUT you need to read the LCD modules datasheet to confirm!
While it's obvious that a 4x20 display can access more than a 2x16, it's up to you to be sure the driver is compatible with your display.
Jay |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jan 14, 2018 7:30 am |
|
|
lcd_putc() is not part of a built-in library. #use i2c(), #use rs232(), etc.
are built-in libraries. lcd_putc() is part of the lcd.c driver file. Driver
files have the documentation for them in comments at the top of the file.
Usually. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Sun Jan 14, 2018 8:27 am |
|
|
Usually.
that's the keyword !
Old school asm programmers will comment every line of code, even the obvious stuff.
Some programmers won't comment at all.
Some assume you KNOW what the device is, how it works and the bits, registers, commands needed to 'make it work'.
Some only code for what they need, not what the device can do.
So it's all down to reading the device datasheets, FAQs and then cutting code.
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Sun Jan 14, 2018 9:58 am |
|
|
and (of course), for a simple text LCD, many users here will recommend PCM_programmer's 'flex_lcd' library (in the code library part of this forum), rather than the CCS supplied library.
It is very reliable, & flexible.
Doesn't support \a, but does support \f, \n and \b.
For \a, it has a lcd_gotoxy, which allows you to position to any row/column. |
|
|
|