Problems writing RAM charters to LCDAppMod, using 4bit parallel mode.
Kimber Hall
Posts: 5
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
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
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
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
·
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...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
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