Shop OBEX P1 Docs P2 Docs Learn Events
Problems writing RAM charters to LCDAppMod, using 4bit parallel mode. — Parallax Forums

Problems writing RAM charters to LCDAppMod, using 4bit parallel mode.

Kimber HallKimber Hall Posts: 5
edited 2009-08-29 04:56 in BASIC Stamp
I called support with a problem with my code.
I am making a device that will track players on/off a paintball field.
I am having a problem moving a value from ram to the lcd.
I have attached the revelent code for you to analize, if you need more I can post it also.

Thanks in advanced,
-Kimber Hall

'Part 1 - Set how many players will enter the field?
players = 2 'default value.
GOSUB debug_sub
players_in_game:
· char = LcdCls·········································· ' clear the LCD
· GOSUB LCD_Command
· PAUSE 100
· char = LcdLine1
· GOSUB LCD_Command
· addr = Msg7a·········································· ' point to message
· GOSUB LCD_Put_String··································· ' write it


·char = LcdLine2
· GOSUB LCD_Command
· LOW RS
· LcdBusOut = players.HIGHNIB································· ' output high nibble
· PULSOUT E, 3················································ ' strobe the Enable line
· LcdBusOut = players.LOWNIB·································· ' output low nibble
· PULSOUT E, 3················································ ' strobe the Enable line
· HIGH RS····················································· ' return to character mode
· PAUSE 300


DO
· GOSUB LCD_Get_Buttons
·· IF buttons = %1000 THEN
··· GOTO add_2_players
·· ELSEIF buttons = %0100 THEN
··· GOTO game_start
·· ELSEIF players = 20 THEN
··· GOTO game_start
· ENDIF
LOOP
Add_2_Players:
· players = (Players + 2)
GOSUB debug_sub
GOTO players_in_game

Comments

  • JDJD Posts: 570
    edited 2009-08-27 20:03
    Kimber Hall,

    I have found some sample code for the 2 x 16 parallel display showing variables. These will need some changes to fit your display, but this should help give a sample of displaying variables on a parallel display.

    I hope this helps,




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-08-28 20:35
    Kimber,

    For clarification are you having trouble writing customer character to the CGRAM or are you having trouble writing variables from the BASIC Stamp to the LCD?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    50 72 6F 6A 65 63 74 20 53 69 74 65
    ·
  • Kimber HallKimber Hall Posts: 5
    edited 2009-08-29 02:35
    Chris,
    Thanks for your help, although the document you sent did not show how to resolve the problem, but I managed figured it out anyway. The LCD charters are in an aray, and you have to pass the correct value to display the charter in that cell. So in the case where I was expecting to pass a value from ram directly to the LCD and have it work was incorrect. I figured out (through brute force) that if I added 48 to the numeric value in ram, it would corispond to the correct value in the table. so the fix for my code worked like this:


    char = (blue_team + 48)
    GOSUB LCD_Write_Char '

    the code for my project uses the same subs and variables (for lcd) as supplied in the sample material on the LCDAppMod page.
    I need work, so if you know of a problem I can help resolve, I am happy to do so.

    Thanks for your time,
    -Kimber Hall

    ...so the anwser to the ultimate (lcd) question is not 42, but 48...
  • FranklinFranklin Posts: 4,747
    edited 2009-08-29 04:16
    If you could attach your complete code it would help.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Kimber HallKimber Hall Posts: 5
    edited 2009-08-29 04:27
    the code is for a commercial project, or I would post it.
    The revelant portion of the code is posted, and uses the sub and variables from the the sample code verbatium, exactly. you can pull the var and subs, and write numbers form a stored value to the lcd.,
    There is no reason to publish the entire work.
    Thanks for understanding.
    -Kimber
  • Kimber HallKimber Hall Posts: 5
    edited 2009-08-29 04:53
    ok, so I changed my mind and made a new sample with complete code. I guess I did make quite a bit of changes to the sample code so it only works with the BS2.
  • Kimber HallKimber Hall Posts: 5
    edited 2009-08-29 04:56
    I guess I should have tested it prior to posting it... Let me know if you have a problem with it....
Sign In or Register to comment.