Shop OBEX P1 Docs P2 Docs Learn Events
LCD + keypad + PAK 1 + PAK 8 =Frequency Generator — Parallax Forums

LCD + keypad + PAK 1 + PAK 8 =Frequency Generator

ArchiverArchiver Posts: 46,084
edited 2001-12-08 15:39 in General Discussion
I am using a 16X2 LCD and a keypad to input data. I need to be able to input
6 digits and store them so that I can enter and display 100,000 to 1 and
everything in-between. I am trying to use the RAM present in the LCD to store
the digits then convert them to the correct total after the entry has
terminated. I am keeping track of the number of digits entered then going
back and scaling the digits that are stored in the LCD memory. Example:
digits entered 123456 which is 6 digits so the leftmost digit is then
multiplied by 100,000 then added to the next digit which is multiplied by
10,000 etc.. I then have the total value entered and displayed correctly on
the LCD. I am using Al Williams Pak 1 to compute 1/x and also the PAK 8 to
output specific frequency pulse trains. The number entered and displayed is
frequency which is then used to calculate pulse width (period). Can anyone
point me to some links or example code that will help me accomplish this
task. Thanks!
AZEASI

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-12-07 13:17
    Hi Azeasi,

    I don't have specific code for you, but I do have a few observations you
    might find helpful. Your keypad code would be simpler if you do it like
    this (this is just pseudo code):

    PAK1_X = 0
    Loop:
    key = read_key ' returns 0-9 or ENTER
    if key = ENTER then done
    PAK1_X=PAK1_X *10 ' load Y with $82200000 and call MULT
    PAK1_X=PAK1_X + key
    goto Loop

    Done:
    ' PAK1_X now has your number
    Compute recip
    Convert to PAK-8 units (5uS or whatever you have it set to)
    Divide by 2 ' 50% duty cycle
    Convert to integer
    Read value and send to PAK-8 ' Since 50% send same number for on and
    off time



    There are a few items in the document library
    (http://www.al-williams.com/awce/doclib.htm) that might help:

    http://www.al-williams.com/awce/paklib.htm - Using the PAK library
    http://www.al-williams.com/awce/pak1bas.htm - Simple PAK-I program
    http://www.al-williams.com/awce/paktemp.htm - Measure temp with a PAK-I
    http://www.al-williams.com/awce/servo_bot.htm - PAK-VIII example (with
    servos, so not quite what you are doing).

    Good luck!

    Al Williams
    AWC
    * Easy RS-232 Prototyping
    http://www.al-williams.com/awce/rs1.htm



    >
    Original Message
    > From: azeasi@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=CI1h58GQEN4DrRDDZm7W4F4oVvELDK31BOXij6FnDYAUKCIPfNobis4m3RM-sqraAg4F3b3A]azeasi@a...[/url
    > Sent: Thursday, December 06, 2001 11:24 PM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Re: LCD + keypad + PAK 1 + PAK 8
    > =Frequency Generator
    >
    >
    > I am using a 16X2 LCD and a keypad to input data. I need to
    > be able to input
    > 6 digits and store them so that I can enter and display
    > 100,000 to 1 and
    > everything in-between. I am trying to use the RAM present in
    > the LCD to store
    > the digits then convert them to the correct total after the entry has
    > terminated. I am keeping track of the number of digits
    > entered then going
    > back and scaling the digits that are stored in the LCD
    > memory. Example:
    > digits entered 123456 which is 6 digits so the leftmost digit is then
    > multiplied by 100,000 then added to the next digit which is
    > multiplied by
    > 10,000 etc.. I then have the total value entered and
    > displayed correctly on
    > the LCD. I am using Al Williams Pak 1 to compute 1/x and also
    > the PAK 8 to
    > output specific frequency pulse trains. The number entered
    > and displayed is
    > frequency which is then used to calculate pulse width
    > (period). Can anyone
    > point me to some links or example code that will help me
    > accomplish this
    > task. Thanks!
    > AZEASI
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    > Subject and Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-08 02:04
    Al
    Thanks for the reply. I am unclear on the pseudo code you provided. What is
    the: PAK1_X=PAK1_X *10 ' load Y with $82200000 and call MULT segment do.
    Where does the $82200000 come from? I am definitely interested in making the
    code simpler. Thanks!
    AZEASI
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-08 02:31
    By PAK1_X = PAK1_X * 10 I just mean multiply X by 10 in the PAK I.

    The $82200000 is from fconvert (on the PAK-I disk). You put 10 in and it
    will tell you that 10 is $82200000 in the PAK-I's world.

    Same thing for the next line, you'd add the integer key to PAK1_X which
    would really require you to move X to Y, load X with the integer,
    convert to floating point, and then call Fadd.

    Regards,
    Al Williams
    AWC
    * Floating point math for the Stamp, PIC, SX, or any microcontroller
    http://www.al-williams.com/awce/pak1.htm

    P.S. I just got finished cleaning up the PDF versions of most of the PAK
    manuals. If you were getting PDF errors or missed having bookmarks, go
    get the latest from the site!


    >
    Original Message
    > From: azeasi@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=V8rlxhqmCP3Dr2cegYWJ1aCk5j5bpIJlFdsEzzdMQ-M-nVrladR3anYjceGkwCx_ebS3FQ]azeasi@a...[/url
    > Sent: Friday, December 07, 2001 8:04 PM
    > To: basicstamps@yahoogroups.com
    > Subject: Re: [noparse][[/noparse]basicstamps] Re: LCD + keypad + PAK 1 + PAK 8
    > =Frequency Generator
    >
    >
    > Al
    > Thanks for the reply. I am unclear on the pseudo code you
    > provided. What is
    > the: PAK1_X=PAK1_X *10 ' load Y with $82200000 and call
    > MULT segment do.
    > Where does the $82200000 come from? I am definitely
    > interested in making the
    > code simpler. Thanks!
    > AZEASI
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    > Subject and Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-08 15:39
    Thanks for the clarification!
    Is it possible to get 1 us pulsewidths out of the PAK 8? Could a special
    version be made available if some minimum order was placed? I only need 4
    channels or less.
    AZEASI
Sign In or Register to comment.