Shop OBEX P1 Docs P2 Docs Learn Events
12 Inputs written to an EEPROM — Parallax Forums

12 Inputs written to an EEPROM

sumguy16sumguy16 Posts: 21
edited 2005-05-07 02:33 in BASIC Stamp
Aye-

I'm in the planning stage for a summer project. I want to read 12 different inputs and store the values in an EEPROM. I would like the resolution of the recording of the data to be in the area of 100Hz. This will require a large EEPROM I know, but that is not my problem. I am concerned that the BS2 will not be able to handle that much data processing. I won't be doing any calculation or modification of the input data, the microcontroller will simply be used as a device that can record a signal and store many times a second. Can the BS2 handle this or any of the STAMP microcontrollers for that matter? If not

A second problem I have is that I would like the time delay between the first input read and the last input read to be as short as possible ( < 10ms ).

Thanks for reading my post,
Adam

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-05-06 06:29
    Just use the INS variable and all twelve will be aquired at nearly the same time.
  • edited 2005-05-06 16:05
    Hello,
    ··········· This is possible, like Paul stated with the Ins, or actually in this case you might want use the Inl for the lower byte and Inc for the upper nib this would make it easier to store to the variables. On the reading of the inputs you could be less then 10ms but the writing to the EEProm on some EEProms can take a few milliseconds.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Stephen Swanson

    Technical Support
    Parallax, Inc.
    sswanson@parallax.com

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-05-06 16:16
    Just to follow-up on what Stephen posted... you can read your inputs (assuming connected to P0..P11) like this:

    Get_Inputs:
    · status = INS & $0FFF


    ... where status is a Word variable.· The '&0FFF' masks out the unused pins in case you have additional control inputs that are not a part of what you want to store.· This also assumes that you inputs are active-high.· If they're active low, but you'd like to store an active state as a '1' you can do it like this:

    Get_Inputs:
    · status = ~INS & $0FFF


    The tilde inverts the bits in the variable it's attached to.· Now that you have the bits, you want to WRITE them to the EEPROM.· With PBASIC 2.5 you can do it like this:

    Save_Inputs:
    · WRITE eePntr, Word status
    · eePntr = eePntr + 2


    The Word modifier in the WRITE instruction will put the inputs value into the EE, writing it low-byte, then high-byte.· Since you are writing two bytes, your pointer needs to be updated by two.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • KenMKenM Posts: 657
    edited 2005-05-07 02:18
    Jon Williams said...

    Get_Inputs:
    · status = INS & $0FFF


    You have got to be kidding, right?· Ofcourse not. Didn't know you could mask on the fly like that....cool !!
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-05-07 02:24
    Sure ... INS is just a 16-bit variable -- you can do anything with it that you can do with any other 16-bit variable.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • KenMKenM Posts: 657
    edited 2005-05-07 02:33
    I knew about INS, or INA, INB, INL etc,

    I did not now about the masking on the fly

    status = INS & $0FFF

    I would have done

    status = INS

    status = INS & $0FFF

    which obviously is not at clever....thanks
Sign In or Register to comment.