Confused.... Help Please!


Closed Thread
Results 1 to 32 of 32

Hybrid View

  1. #1
    Join Date
    Sep 2010
    Posts
    17


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by cncmachineguy View Post
    It would go from 4385559271 -->4389271. No space in it.

    Don't think of scrolling the display. Think of your array like this:

    If I have 31 positions for the numbers, They will be T(30) to t(0)
    each "scroll" is really just an update to the LCD, sending array positions T(30)-T(0)
    with all the elements shifted 1 place to the left. (new targets enter from the right?)
    you will be able to do MANY operations before time to scroll again. Those many operations are the checking for hits, adjusting the array and so forth.

    Keep this in mind, assuming you are running 4mHz internal clock (no I haven't looked at the datasheet) thats 1 million inscrutions per second. if you want to scroll at a rate of .1 second, you have time left over for 100,00 inscrutions. So the "scrolling" is just a quick task, then done.

    Now I have no idea how to actually write to the LCD, but I am assuming you just send it all the characters serially and not address each charater randomly. So your array may need to be 64 bytes instead of 32.
    So would you shift the 438 right to meet the 9271 or the opposite? because if its the opposite then it isnt really helping the player by shooting the middle numbers now is it? since they continue to be in the same position and will just keep adding on... unless of course they then shoot the front numbers

  2. #2
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by UKIkarus View Post
    So would you shift the 438 right to meet the 9271
    Yes, that way the player keeps the targets from hitting the ship.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  3. #3
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default new approach

    Ok, Lets establish some basics first.

    In your first post, you have a program that scrolls numbers across the screen at a rate of 1 sec per number. correct?

    You are reading the numbers from an array, correct?

    So if you take out the pause, it will just instantly display the whole array? If yes, this is your LCD update. call this every time you need to change the display.

    reasons to update or change:
    1. time to scroll
    2. aim button pressed so you need to change the aim number
    3. fire button pressed AND a hit is made

    Now you can forget about the LCD. when you update it, send all 32 characters to it (unless random access is available, but this will take more code and understanding). The game portion of the program will minipulate the array so everytime in update is done, the numbers will be where they should be. Because they will be in the same position as they are in the array.

    If none of this makes sense, please tell me where you are lost. This applies to all of my above posts.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  4. #4
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default

    oh yea, one more thing. Ask dad if there is any hardware de-bouncing on the switches. If not, they will be something you will need to deal with in software.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  5. #5
    Join Date
    Sep 2010
    Posts
    17


    Did you find this post helpful? Yes | No

    Default

    Ok i can rebuild the array as you say and debouncing i have done in the software, the problem i have is that the scrolling text code only is a for next loop which is running cell by cell on the lcd not updating the whole thing.

    I could update the whole thing by starting with 14 blank array spaces at start rather than filling it all, and adapt the array 1 by 1 that way until 0-13 are filled with the numbers behind them (coming from the right) that way i can just update the lcd everytime with NOS[1-14] which will be the only onscreen values since 1-2 are taken by the number followed by a colon.

  6. #6
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default

    I think you are following me now. the LCD is really static, not scrolling, the array is what scrolls. Yes, as I posted in the beginning, start with the array filled with blank spaces or " " if you will.

    try it out at first with just adding a number to the array every second, then updating the LCD. it should have the scroll effect you are looking for. The number you add to the array should be a random number, I don't recall if PBP has a random number generator, but you could just increment the number for now.

    Once you have that worked out, move on to making the aim change as you press the aim button. from there its all just logic and playing with the array.
    Last edited by cncmachineguy; - 28th September 2010 at 16:20.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  7. #7
    Join Date
    Sep 2010
    Posts
    17


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by cncmachineguy View Post
    I think you are following me now. the LCD is really static, not scrolling, the array is what scrolls. Yes, as I posted in the beginning, start with the array filled with blank spaces or " " if you will.

    try it out at first with just adding a number to the array every second, then updating the LCD. it should have the scroll effect you are looking for. The number you add to the array should be a random number, I don't recall if PBP has a random number generator, but you could just increment the number for now.

    Once you have that worked out, move on to making the aim change as you press the aim button. from there its all just logic and playing with the array.
    Indeed, I continue to underestimate the speed of 20Mhz.

    I will be able to use the array manipulation as you say in a for next loop easily

    I think i will first start with the shooting the far left number only for now and then move onto numbers anywhere later on since that will require that I scn the array and adjust it many times.

    I do have the number changing figured out and also the "n" character and I can also shoot thats no problem ... I have the debounce and all that sorted it was just the scrolling i wasnt sure about since I was thinking of another approach.

    Unfortunately since pbp does not support that approach directly its alot easier to just as you say manipulate the array, I will get on with programming it tomorrow.

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