Shop OBEX P1 Docs P2 Docs Learn Events
need help learning — Parallax Forums

need help learning

robertoroberto Posts: 37
edited 2006-03-27 20:37 in BASIC Stamp
This is the code i used to display my keytroke from my keypad to the lcd (using a keypad ecoder 74c922)it works great...
how would i store those entry in the basicstamp eeprom is that possible? how do i add that in my code
i am using a tutorial hand book that has no info on logging entry.

btn var byte
number var byte
A var byte
B var byte
C var byte
D var byte
n9600 con $4054 'baudrate
clrLCD con 12 'clear LCD
input 1 'makes pin 1-5 a input
input 2
input 3
input 4
input 5
btn =0
loop:
button 1,1,50,10,btn,0,nokey 'check pin 1 for data
'available for keypress(1 for but press 0 for no but pres)
A=in2 'put binary value into a variable
B=in3 ' "
C=in4 ' "
D=in5 ' "
serout 0, n9600, [noparse][[/noparse]bin A, bin B, bin C, bin D,cr] ' display the
binary value of the key pressed
A=1*A ' Lsb convert a binary 1 to 1 or 0 to 0
B=2*B ' convert a binary 1 to a 2 and a 0 to 0
C=4*C '· " ··· "··· "·· 1 to a 4 and a 0 to 0
D=8*D 'msb convert a binary 1 to a 8 and a 0 to 0
Number =A+B+C+D 'convert to a decimal
serout 0,n9600, [noparse][[/noparse]dec Number,cr] 'display a 0-15 on LCD
pause 2000
serout 0, n9600, [noparse][[/noparse]clrLCD] 'clear
nokey: goto loop



thanks for any help

Comments

  • agentileagentile Posts: 101
    edited 2006-03-27 19:40
    You can store byte sized variables into eeprom using the WRITE command.

    WRITE address,value

    So, if you wanted to write the number $15 to address location $100, you would write,

    WRITE $100,$15.·

    There is a pitfall to using this command.· WRITE will write wherever you tell it to, even if you already have something stored in that location.· Also, the data stored during a WRITE cycle will not show up in your memory map.·
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-03-27 19:49
    You might want to give our "What's A Microcontroller" a read -- it's a great place to get started and many of the convenient tricks of the BASIC Stamp are revealed. For example, the BASIC Stamp allows Nib (4-bit variables) and if you connect your inputs on Nib boundaries, you don't have to go through all the trouble of calculating the value from the inputs. Also, the SEROUT instruction has a BIN modifier that will transmit a value in binary (text) format.

    We've got lots of information to learn from, you just need to spend a bit of time reading. It will be worth it though, and your programming time will become more effective and productive.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • robertoroberto Posts: 37
    edited 2006-03-27 19:55
    do you have to buy that book does someone have it in pdf for share ?
    would be greatly appreciated

    thanks
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-03-27 19:59
    Yes, it can be difficult to navigate the Parallax site.

    There's so much support there, it can be hard to find the piece you need.

    http://www.parallax.com/html_pages/downloads/siccurriculum/documentation_sic_curriculum.asp

    Scroll down to the "What's a Microcontroller" entry.· Right-click on "download", and save it somewhere on your hard disk.
  • Kaos KiddKaos Kidd Posts: 614
    edited 2006-03-27 20:17
    I was looking at downloading theses some time ago, and I thought, for what ever reason, that I wasn't permitted to because I wasn't a member or didn't purchase into the "stamps in class" books... I take it they can be downloaded for free?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Just tossing my two bits worth into the bit bucket


    KK
    ·
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-03-27 20:25
    Yes, all of our PDF documents are available online at no charge.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-03-27 20:34
    Folks -

    Just a quick sidenote on downloading the Stamps in Class documents and curricula. As is CERTANLY appropriate, they can not be downloaded and used for commercial purposes (money making uses). Other than that use, they are just as available as any of the other excellent Stamp Manuals and Documents.

    Thank you PARALLAX!

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • robertoroberto Posts: 37
    edited 2006-03-27 20:37
    Thanks alot will come back after the reading is done thank you all
Sign In or Register to comment.