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

Resources for a project (LCD,ADC,EEPROM, PID, DS130x ....)

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



Joined: 17 Nov 2009
Posts: 50

View user's profile Send private message

Resources for a project (LCD,ADC,EEPROM, PID, DS130x ....)
PostPosted: Thu Nov 19, 2009 3:53 am     Reply with quote

Hi,

I have few questions about a project of mine. Smile

Project includes:
-ADC with Vrefs (already done)
-LCD KS0066 16x2 ( atm. im done with flexlcd example)
-Interface for a "menu system" on LCD min. 3 buttons
-EEPROM ( to save interface LCD menu values when power fails )
-PID
-DS130x RTCC
-Timers with interrupts

Device is PIC18F45K20.


I'm looking for a examples, I can use and learn from.
I'm sure you are more experienced MCU user and more familiar with this very forum and CCS compiler. I like to believe that you can help me to find what I'm looking for in a form I may like, because due my low experience I may not know how to achieve my targets effectively. For example I worked on a small LCD code for almost a week and later I finally found out that the LCD is broken. Very Happy


-------- ADC value to a LCD ------------

Atm. I'm looking for way to display a ADC value on LCD. Is there a function which converts variable types ? How to display a text and variables at the same time ?

-------- Interface & LCD menu ------------

Are there any LCD menu examples I can look for ? How many buttons is good to move around and change number in menu .... ? 4 up down OK ESC ? or 6 ?
How much more performance I can achieve if I use interrupt routines (I got 0 experience ) and how much more complex it will be for me ?
I'll appreciate a good sample or a tutorial on principles used.

-------- PID algorithm ------------

Can I find PID algorithm on this forum that I can use ? An include file maybe ?

--------- ......... ------------


I'll try to treat every thought, idea, reply with the highest priority.

Thank You.


Last edited by MiniMe on Thu Nov 19, 2009 7:19 am; edited 3 times in total
MiniMe



Joined: 17 Nov 2009
Posts: 50

View user's profile Send private message

ADC value to a LCD
PostPosted: Thu Nov 19, 2009 7:02 am     Reply with quote

Well ...
I asked and i will answer Wink

-------- Displaying ADC value on LCD ----------------

As you can see from a program code below, im using itoa() function to convert int (my case int16 from a ADC function return) to a char string. I'm displaying each string unit (char) separately.

I have looked a function like it on this forum for a long time now, still cant find what im looking for... perhaps there is a better function that this one.

Code:


#include <stdlib.h> for itoa

void main()
{

int a = 48;
int16 x=1234;
char string[10];

lcd_init();  // Always call this first.
while(1)
   {
   //dealy_us(1);
   x = Adcfunkt();
   output_d(x);
   
   itoa(x,10, string);     // string is now “int16 x”
   
   
   
   lcd_putc("\f |||||||||||\n");  // First line
   lcd_putc(a);                  // Second line
   lcd_putc(" "):
   lcd_putc(   string[0]     );
   lcd_putc(   string[1]     );
   lcd_putc(   string[2]     );
   lcd_putc(   string[3]     );
   lcd_putc(   string[4]     );
   lcd_putc(   string[5]     );
   lcd_putc(   string[6]     );
   lcd_putc(   string[7]     );
   lcd_putc(   string[8]     );
   lcd_putc(   string[9]     );
   
   }
}

Ttelmah
Guest







PostPosted: Thu Nov 19, 2009 9:54 am     Reply with quote

printf(lcd_putc,"\f |||||||||||\na %lu ",x);

This has been answered many tens of thousands of times on the forum, and is such a basic part of C, that I suspect everyone was assuming you wanted something more complex than this...

Best Wishes
MiniMe



Joined: 17 Nov 2009
Posts: 50

View user's profile Send private message

PostPosted: Sun Nov 22, 2009 10:19 am     Reply with quote

Thank you for a reply.
You are absolutely right I've got very little C programming experience. I'm pretty sure that there are many things, including basics, that I do not know.

Everything is difficult, before it is easy right ? ... Including basics. ;)


I've made some progress lately, already I'm seeing a external RTCC DS1307 displaying time on LCD. Now I'm having some difficulties with HOW TO part. How to connect ... link together different parts of program (functions).

How to organize priorities in a system, I mean how often and which function to call. For example I definitely know that I do not need to update a clock value display on LCD every 10 ms ... after all 1 sec is what I need. I know that 10 ms is better than 1 sec, but there are more important functions to monitor and to act on.

How to call different functions during program work flow. Will a counter ("int16 a++" "every x cycle") work or a timer is what I need ? What are the techniques used in familiar case.
-----

Also I'm having some questions about keypad and interface. I've decided that there will be 4 navigation buttons (UP, DOWN, LEFT and RIGHT) and 2 more buttons ( ESC and OK).

Devise needs to be configured once or twice during the work time.

So it will be wise to set up some kind of trigger to enter parameter setup mode. For example PID parameters or a clock setup.
What is the smart way to enter a menu ... parameter changing mode ? Is there technique i should know about ?

Is is good idea to use a switch statement (for a different menu elements) and a function or functions to increase parameter values.

Are there samples i should learn from ? Can you point them out.

HOW TO ? advise ...

-------

Thank you !
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