Shop OBEX P1 Docs P2 Docs Learn Events
get data from a PaK11 and dispaly it on an lcd — Parallax Forums

get data from a PaK11 and dispaly it on an lcd

VbGuruVbGuru Posts: 35
edited 2006-04-22 16:29 in BASIC Stamp
I am using the Homework board and Am trying to get a program to·get data from a·PaK11 and dispaly it on an lcd. I have a chunk of code that will display information on a LCD (which i have hooked up)

' =========================================================================
' File...... Parallel_LCD_2X16.bs2
' Purpose... Parallel LCD Display Demo
' Author.... Parallax, Inc.
' E-mail.... support@parallax.com
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[noparse][[/noparse] Program Description ]
' This program demonstrates using a Hitachi-compatible Parallel LCD Display
' This code works with the BS2, BS2e and BS2sx
'
[noparse][[/noparse] I/O Definitions ]
E PIN 0 ' Enable Pin For LCD
RW PIN 2 ' R/W Pin For LCD
RS PIN 3 ' LCD Register Select
' 0 = Instruction, 1 = Text
'
[noparse][[/noparse] Variables ]
char VAR Byte ' Character To Send To LCD
inst VAR char ' Induction To Send To LCD
index VAR Word ' Character Pointer
temp VAR Byte ' Temp Variable
'
[noparse][[/noparse] EEPROM Data ]
DATA "Hello, this is the LCD demo." ' Message To Send To LCD
'
[noparse][[/noparse] Initialization ]
Initialize:
LOW RW ' Set LCD To Write Mode
OUTS = %0000000000000000 ' Set All Output Low
DIRS = %0000000011111111 ' Set I/O Direction
GOSUB Init_Lcd ' Initialize The LCD Display
'
[noparse][[/noparse] Program Code ]
Main:
FOR temp = 0 TO 27 ' 28 Characters
IF temp = 15 THEN ' Check For End Of Line
GOSUB Next_Line ' Jump To Next Line
ENDIF
READ temp, char ' Read Next Character From EEPROM
GOSUB Send_Text ' Send Character To LCD Display
NEXT
END
'
[noparse][[/noparse] Subroutines ]
Init_Lcd:
PAUSE 200
OUTS = %00110000 ' Reset The LCD
PULSOUT E,1 ' Send Command Three Times
PAUSE 10
PULSOUT E,1
PAUSE 10
PULSOUT E,1
PAUSE 10
OUTS = %00100000 ' Set To 4-bit Operation
PULSOUT E,1
Inst = %00101000 ' Function Set (2-Line Mode)
GOSUB Send_Inst
Inst = %00001110 ' Turn On Cursor
GOSUB Send_Inst
Inst = %00000110 ' Set Auto-Increment
GOSUB Send_Inst
Inst = %00000001 ' Clears LCD
GOSUB Send_Inst
Inst = 14 ' Set Cursor To Underline
GOSUB Send_Inst
RETURN
Send_Inst:
LOW RS ' Set Instruction Mode
OUTB = Inst.HIGHNIB ' Send High Nibble
PULSOUT E,1
OUTB = Inst.LOWNIB ' Send Low Nibble
PULSOUT E,1
HIGH RS ' Set LCD Back To Text Mode
RETURN
Send_Text:
OUTB = Char.HIGHNIB ' Send High Nibble
PULSOUT E,1
OUTB = char.LOWNIB ' Send Low Nibble
PULSOUT E,1
PAUSE 100
RETURN
Next_Line:
Inst = 128+64 ' Move Cursor To Line 2
GOSUB Send_Inst
RETURN

I Have the Pak11 bread boarded up with the mouse connected to it. I just need to get the stamp program set up so that i can have the lcd dispaly the data and so that the data displayed is the running total.
http://www.awce.com/pak11.htm
here is a bit of code but it gives errors.
http://www.awce.com/pak11note.htm
I am new to Stamps I have dabled (newbie!!) with Pics and MBASIC.
I know that these are just bits of other peoples work. I am looking to get this running so that I can go through the code and understand it. I can then go through it and understand it. I have been learning Mbasic and have been going through a few books I just got (project by project). I have done some looking and havent fonud much for this.·I have gone through the "what is a microcontroller book".

Also sorry for any spelling errors.

Thanks
······ Mat


Post Edited By Moderator (Chris Savage (Parallax)) : 4/21/2006 3:51:14 AM GMT

Comments

  • firestorm.v1firestorm.v1 Posts: 94
    edited 2006-04-21 21:33
    The code that you post is the example code for the LCD parallel 2x16 display. Does that code at least print the text "Hello this is the LCD Demo" on your LCD display?
  • VbGuruVbGuru Posts: 35
    edited 2006-04-21 21:45
    Yes, I have the code and the lcd working together.· I have done·a few·things with lcds and mbasic, so it wasnt much·harder than figuring out the syntax difference. The rest though..... I havent done anything with before so i cant base any problems on any prior exp.


    Thanks!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-04-22 02:53
    In the future please attach long codes like this.· Pasting them into the message loses the formatting and makes it more difficult to read.· As an attachment it can be loaded directly into the editor and run or compiled.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • VbGuruVbGuru Posts: 35
    edited 2006-04-22 16:29
    Will Do.··



    Update:· I have the stamp showing me data now. I havent gotten it to give me a running tally yet though
Sign In or Register to comment.