Line Graph, math problem...


Results 1 to 3 of 3

Threaded View

  1. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    I think I don't quite understand the question. Your lcd can only show in decimal 1 through 48, so shouldn't decimal be ok to work with? If you are asking about how to average your remainder so you can display the right pixel, then you could do your divide by 100, for the pixel, then take your remainder. If your remainder > 49 then pixel = pixel + 1. This is saying that if your division returned 24.5 or higher, it would be displayed as pixel 25. This would smooth out your line graph a little bit.

    Is that what you are getting at?

    Or, if you are saying that you do have a decimal point (or a decimal after your whole number), then you can do something with it. Same as above, but if you have 245, then 245//10 will give your remainder. If remainder > 4 then pixel = pixel + 1

    Added:
    Ok, if you're asking how to figure out what page and pixel to display.......:
    Say you want to display pixel 10 of the 48 pixels. 10/8 = 1 so it is on page 1 (of 0 to 7 pages). Now for the pixel of that page, you take the remainder 10//8 = 2. So it is pixel 2 on page 1 we need to display.
    Last edited by ScaleRobotics; - 5th May 2009 at 21:52.
    http://www.scalerobotics.com

Similar Threads

  1. Using input from Switch to control a loop
    By MrRoboto in forum mel PIC BASIC
    Replies: 9
    Last Post: - 2nd February 2009, 05:02
  2. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  3. PicBasic Pro Math Problem??
    By Glen65 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th March 2006, 04:36
  4. Math Formula / Variable Problem! Help!
    By bwarp in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th February 2006, 07:59
  5. having problems with Hantronix 20x4 lcd
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 22nd December 2005, 12:22

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts