Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

LCD and keypad, scroll problem

Status
Not open for further replies.

sarang1_in

New Member
Hi all.
I want to put 4 different set points on LCD eg.
Temperature LINE 1
5.4 LINE 2

Pressure LINE 1
22.5 LINE 2

Low LINE 1
39 LINE 2

High LINE 1
245 LINE 2

I have done this, but now I want to increment or decrement them to a perticular max point. I have a scroll ,Up, Down keys with me. When I will press scroll the cursor sholud move one step to right and if I press inc or dec, it will inc or dec that perticular number from 0 to 9. Here is some problem. I would like to control the code size. I am using AT89S8252 and 16X2 LCD in 8 bit mode?

Any suggestion????

Thanks in advance.
 
I just finished 2 projects both with LCD scroll and keypads.My way may not be good enough,but I'm just offering some info.

I think it's simple to do that.First make sure there're variables defined corresponding to each number you want to display.And set high&low limits for all of them to make the value loop back when you reach the limits while scrolling.Next,group them,and list them in a certain sequence.Define as many pointers as necessary.E.g,pointer indicating position of the cursor,pointer signifying the current variable you are operating,etc.Then you will have to change the variable pointer as well as the the cursor pointer in the function (or subroutine) which processes the 'Scroll' keystroke.And you need to update the position of the cursor on the LCD corresponding to the cursor pointer's value.After this,you have to increment the variable designated by the variable pointer in the 'INCREMENT' keystroke's function and decrement it in the opposite one.Make sure the value loops back as I previously mentioned.I think you can figure out the rest.

Good luck!
 
hi,
Thanks, but the same way I did and had huge code from my Keil compiler. There are some 8 variables and all are not necessarily ints. (Few are floats as well, so increment shifts down to 0.1 and 0.01...) In fact I have a lot other things to do and few floating point arithmatics too.
Anyway Thanks for your reply.
 
sarang1_in said:
hi,
Thanks, but the same way I did and had huge code from my Keil compiler. There are some 8 variables and all are not necessarily ints. (Few are floats as well, so increment shifts down to 0.1 and 0.01...) In fact I have a lot other things to do and few floating point arithmatics too.

There is only very rarely a need to use floating point, it makes for large files, VERY slow programs, and is also inaccurate. It's usually far better to use integer maths and scale them accordingly, these are smaller, MUCH faster, and 100% accurate.

The size of integers you need is obviously dependent on the range of your values, but 16 bit ones allow a range of 65,535.

If you're concerned about program size, you might also consider using assembler rather than C, as 'Alex_rcpilot' said, it's quite a simple thing you want to do!.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top