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

What are the functions to output to a LCD Display?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest








What are the functions to output to a LCD Display?
PostPosted: Sun Oct 04, 2009 11:26 am     Reply with quote

Hi people,

Can anybody tell me what are the functions to output data from the memory to the LCD Display ?

Thank you.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Oct 04, 2009 1:45 pm     Reply with quote

Use the printf function, and re-direct the output to the lcd, as shown
below. The printf function will format the variable so it will display
properly on the LCD. Using the lcd_putc function at the beginning
of printf will cause the output of printf to go to the LCD.
Code:

#include <16F877.H>
#fuses XT, NOWDT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)

#include<flex_lcd.c>  // LCD driver from CCS code library forum

//======================================
void main()
{
int16 value;

lcd_init();   // Always call this function first

value = 1234;

printf(lcd_putc, "Value: %lu", value);  // Display 'value' on the lcd

while(1);
}
Guest








PostPosted: Sun Oct 04, 2009 9:54 pm     Reply with quote

Is the lcd_putc function only for internal LCD screens ?

If i am using external LCD, am i still able to use this function ?

Thanks for your help.
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Sun Oct 04, 2009 11:15 pm     Reply with quote

What exactly do you mean by 'internal' and 'external' LCD screens? Do you, instead, mean 'PICs with internal (built-in) LCD driver' and 'other PICs'?

All PICs are capable of driving external LCD displays, ie, those LCDs that have an external display driver. The display driver is a chip on the LCD module which communicates with the PIC, using a simple parallel or serial interface. An example is the HD44780-based character LCD, which uses a parallel interface.

On the other hand, simple LCD panels are also available in the market. The panels do not have a display driver chip. All display voltages and timing signals need to be generated by a driver chip. PICs with a built-in LCD driver are capable of generating these voltages and timing signals. Thus, these PICs can act as customized LCD drivers.

Quote:
Is the lcd_putc function only for internal LCD screens
The lcd_putc function provided in the FlexLCD sends character data to an HD44780-compatible LCD. So you can say it is for 'external' LCDs only.

Rohit
Guest








PostPosted: Sun Oct 04, 2009 11:43 pm     Reply with quote

Thanks for your reply Rohit de Sa,
What I mean by external and internal LCD is:

Internal LCD are LCDs that are built in with the PIC board, whereas External LCD are LCDs that are seperate from the PIC board, you have to buy them and fix the connection by yourself.

If I want to display a waveform on my LCD, do I just add in this after my A2D conversion?

Example:
Code:

printf(lcd_putc, "Value: %lu", value);  // Display 'value' on the lcd

I am really new to CCS, the way of coding is so different.
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Mon Oct 05, 2009 12:46 am     Reply with quote

Which development board are you using? Post a link, or give additional details. Which LCD are you using? Post a link/details.

Quote:
If I want to display a waveform on my LCD
For this you will need a graphical LCD, not a character LCD. The lcd_putc function found in the FlexLCD driver file can only be used for HD44780-compatible *character* LCDs.

Rohit
fr0stb0iz



Joined: 29 Sep 2009
Posts: 13

View user's profile Send private message

PostPosted: Mon Oct 05, 2009 9:21 am     Reply with quote

Yes, i am using a graphical LCD, the LCD that i am currently using is the can be found here ( http://store.gravitech.us/13secogrlcd.html ) ( Epson) and the developement board that i am using can be found here ( http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en010072)

That means that i am not able to use the lcd_putc function, so what other functions can i use ?


Last edited by fr0stb0iz on Mon Oct 05, 2009 9:28 am; edited 1 time in total
fr0stb0iz



Joined: 29 Sep 2009
Posts: 13

View user's profile Send private message

PostPosted: Mon Oct 05, 2009 9:23 am     Reply with quote

yes there are other sample codings, but none of the codes are in CCS, and i have no idea how to translate them.
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Mon Oct 05, 2009 11:22 am     Reply with quote

Quote:
yes there are other sample codings, but none of the codes are in CCS
Umm....yes there are....you've just not checked.
http://gravitech.us/MicroResearch/Others/LCD6100/PICC_NOKIA6610.zip

The code uses an 18F458. To use it with any other PIC all you'd need to do is modify a few of the preprocessor directives.

Rohit
Guest








PostPosted: Mon Oct 05, 2009 7:29 pm     Reply with quote

Yes I know Rohit, but there are no codes that teach you how to display a waveform!

I am currently using that person's code. But in order to display a waveform, I do not know what must be done.

Sorry, not that I am lazy, but I really do not know anything.
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Mon Oct 05, 2009 9:01 pm     Reply with quote

A simple algorithm for a very crude oscilloscope would be:

Code:
while(1)
{
     LCD_Fill_Screen(WHITE,0,0,131,131);   //blank the entire screen

     for (x=0;x<131;x++)
     {
          read the adc;
          scale the adc reading if necessary using simple maths;
          pset(RED, x, scaled_adc);
     }

     //you may need to add a small delay here
}

You need to insert the correct code. Also remember to initialize the ADC and the LCD properly.

Rohit
fr0stb0iz



Joined: 29 Sep 2009
Posts: 13

View user's profile Send private message

PostPosted: Mon Oct 05, 2009 9:37 pm     Reply with quote

Thx alot Rohit, What do you mean by scale the ADC?
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Mon Oct 05, 2009 9:56 pm     Reply with quote

The function 'pset' is defined in the source file (ie nokial6610_ccs_c.c) given in this zip http://gravitech.us/MicroResearch/Others/LCD6100/PICC_NOKIA6610.zip

This is the function prototype:
Code:
void pset(unsigned char color, unsigned char x, unsigned char y);


By 'scale the ADC reading' I mean 'perform some math functions on it if necessary'. Analog readings from some sensors are not linear; ie, the sensor output does not vary directly with the changing environmental variable. Also, you may need to adjust the ADC output for proper display. An 8-bit ADC will read from 0-255. The LCD screen can only display from 0-131. You need to use a scaling factor of (131/255) for the ADC readings to fit properly on the screen.

Rohit
fr0stb0iz



Joined: 29 Sep 2009
Posts: 13

View user's profile Send private message

PostPosted: Mon Oct 05, 2009 10:18 pm     Reply with quote

Thank you very much Rohit, I will work on it and get back to you. Cheers!
fr0stb0iz



Joined: 29 Sep 2009
Posts: 13

View user's profile Send private message

PostPosted: Mon Oct 05, 2009 11:51 pm     Reply with quote

Sorry Rohit,

The term x in the following code is refering to the X axis, or is it an unsigned int x ?

Code:

for(x=0;x<131;x++)
   {
    read the adc;
    scale the adc reading if necessary using simple maths;
    pset(RED, x, scaled_adc);
   }
 
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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