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

how to write OR display data read by adc in LCD and edit?

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



Joined: 20 May 2014
Posts: 21

View user's profile Send private message

how to write OR display data read by adc in LCD and edit?
PostPosted: Mon May 26, 2014 1:36 am     Reply with quote

http://s1.postimg.org/k52ed0iq7/concept.jpg

Hi friends,
anyone by seeing the above diagram suggest the idea of the code to write, having four DI's one for mode (capture mode and edit mode for LCD) for reading the ADC value and set the min and max value....increment & decrement button to be used for selecting the mode (as arrow keys), and save button is used to save the selected mode or enter into a particular mode. Finally the total circuit should act as ADC comparator and digital indicator with controller.
Hope you guys will get what I am expecting?
_________________
e-learner
temtronic



Joined: 01 Jul 2010
Posts: 9173
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon May 26, 2014 6:00 am     Reply with quote

I'd start by getting the PIC to blink an LED at 1Hz to confirm the hardware is good.
Then use the flex_lcd driver that PCM_P wrote(in the code library) to confirm the LCD module is good.Hint, your schematic is in error.

Once that works right, then get the 'buttons' to function. Cut code to see a button was pressed by displaying it's name(or number) on the LCD.You will require some debounce though, a topic covered here several times.
part four would be to read the adc, display the raw value on the LCD.

part five.combine all that you've learned into one big program.

CCS supplies LOTS of great examples of code you can learn from in the 'examples' folder.

Once you've got past step two report back...
The 'secret' is to breakdown the assignment into smaller sections and complete each one BEFORE trying to do something else.

Overall , less than a week of easy 2-3 hours per night and you're done.

hth
jay
e-learner



Joined: 20 May 2014
Posts: 21

View user's profile Send private message

RE:
PostPosted: Mon May 26, 2014 7:09 am     Reply with quote

Thanks for your reply, but still I am not clear how to use the buttons to work the lcd in edit mode, like moving the cursor and enter the data in LCD directly and saving the entered data using the buttons? Is there any example in which LCD is used in edit mode.


And pls mention me the error in schematic....... Mad
_________________
e-learner
dyeatman



Joined: 06 Sep 2003
Posts: 1924
Location: Norman, OK

View user's profile Send private message

PostPosted: Mon May 26, 2014 7:17 am     Reply with quote

So this is in Proteus, not real hardware...and likely a school project.

One data connection to D7 on the LCD is missing.
You are missing VEE circuitry completely.

If you want code to make changes on the LCD using a push button interface
you'll need to either build the message in PIC memory and edit it then
send it to the display or read the display memory.
_________________
Google and Forum Search are some of your best tools!!!!
temtronic



Joined: 01 Jul 2010
Posts: 9173
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon May 26, 2014 7:52 am     Reply with quote

Some but not ALL errors
1) no ground to PIC
2) no power to PIC
3) no clock source(xtal with caps or ??)
4) LCD Vee not connected
5) LCD D7 not connected
6) no pulldown R on INC
7) no pulldown R on DEC
8) no pulldown R on MODE
9) no pulldown on SAVE
and that's just the easy ones to spot...

You MUST tell us if this is REAL hardware of 'Proteus/ISIS' simulation.
if the former we can help you get it working
if the latter you will NEVER get it to work properly,can't be done!

hth
jay
e-learner



Joined: 20 May 2014
Posts: 21

View user's profile Send private message

RE:
PostPosted: Mon May 26, 2014 11:33 pm     Reply with quote

OK thanks for all your reply...
_________________
e-learner
RF_Developer



Joined: 07 Feb 2011
Posts: 839

View user's profile Send private message

Re: how to write OR display data read by adc in LCD and edit
PostPosted: Tue May 27, 2014 3:28 am     Reply with quote

e-learner wrote:
...suggest the idea of the code to write, having four DI's one for mode (capture mode and edit mode for LCD) for reading the ADC value and set the min and max value....increment & decrement button to be used for selecting the mode (as arrow keys), and save button is used to save the selected mode or enter into a particular mode. Finally the total circuit should act as ADC comparator and digital indicator with controller.


This is all basic firmware development stuff, but here goes:

Whenever you get a problem like this, you need to split the code up into logical chunks; related but separate functions that you can work on easily.

At first sight this problem has four basic functions, in no particular order:

Reading the switches.
Converting the input to digital with the ADC.
Doing some stuff to the data.
Displaying the result.

It makes sense to do these four, and maybe some stuff to link them to each other, in a simple loop that does each in sequence. Each can be developed and tested on their own, so you can build the code up step by step.

The first thing to do is none of these however. The first is to get the PIC running at the right speed. That's done with a very simple LED flashing code. Forget the LCD, for get the ADC, forget the switches, in fact forget everything else until you've got the PIC up and running at the speed you expect.

Then pick one section and work on that. You may want to leave the worst till last, or you may want to dive right in and get the tough stuff out of the way. Its usually the LCD that causes inexperienced coders the most trouble, so that's where to start/finish after you've got the PIC running with the LED flasher. Be very aware that real LCDs tend not to be very much like their Proteus versions. Just because you've got it to work in Proteus has little bearing on whether it'll work with real hardware. The problem is Proteus, which doesn't simulate PICs and LCD modules very well.

Then get each section working, one at a time. Finally, when you know the bits are working separately, tie them altogether with code. Its at this stage that timing and sequencing problems often show themselves. Do you really need to sample the ADC that fast when the LCD can only cope with 4 updates a second? What about switch debouncing (which really you should have sorted by this stage). These are just two of the possible problems that can arise in even such a simple project as this.

The key is to do any project stage by stage. Splitting it into manageable chunks makes development much simpler.

Later you will find that you can use and adapt these firmware chunks in other projects.
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