Shop OBEX P1 Docs P2 Docs Learn Events
MORE: PINK email addresses — Parallax Forums

MORE: PINK email addresses

GeorgeGeorge Posts: 11
edited 2007-01-31 00:40 in General Discussion
Thanks·Chris,

I think I have the code from your example modified and working.

However, I'm not using data statements to place the addresses into an emptly slot on the BS2P24 EEPROM.
I have a web form that I am populating with addresses and submitting.
Then I read the data from the web variables into EEPROM storage addresses.

My problem is when I read from the web variables a byte at a time, I seem to be missing every other character.
Here is what I am doing:


···NameHolder·· VAR· Byte··· ' temporary holder for email address
·· eeAddr·······VAR· Word··· ' address pointer
·· azero······· CON···· 0··· ' ascii zero character
·· pinkinpin··· CON···· 7··· ' From PINK module serial out
·· pinkoutpin·· CON···· 6··· ' To PINK module serial in
·· pinkbaudrate CON· 1021··· ' 2400 serial comm to PINK
· SEROUT pinkoutpin,pinkbaudrate,[noparse][[/noparse]"!NB0R52"]·'read email address from web page
· DO······································ ' get address from web variable and write to eeprom.
··· SERIN pinkinpin,pinkbaudrate,[noparse][[/noparse]STR NameHolder\1]
··· DEBUG NameHolder······················ '·display result
··· WRITE eeAddr, NameHolder·············· ' write value
··· eeAddr = eeAddr + 1··················· ' increment address for next read
· LOOP WHILE NameHolder <> 0·············· ' get next character
· WRITE eeAddr + 1, azero················· ' add ascii zero
If the address were "1234567890", debug prints "13579".
I am thinking my SERIN statement is to blame.

Also, the user has up to 48 characters for each email address on the web form. Of course he normally won't need all 48 bytes for most addresses. So will there be an ascii zero at the end of the bytes he used? Or, said another way, will my LOOP work?

Thanks,
George

Comments

  • BeanBean Posts: 8,129
    edited 2007-01-25 12:22
    George,

    Your loop won't work because while the DEBUG command is sending the first character, the second character is being transmitted. Therefore your SERIN will miss it. By the time you get back to the SERIN command, you get the third character, and so on.

    I'm not familiar with the PINK, but if it has a pacing or delay that you can setup between character, that would solve the problem. If not, then you must receive the entire string before you use DEBUG to send it out.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-01-25 15:40
    George,

    ·· In the other thread (linked below), you gave me the impression your addresses were already stored in the EEPROM so that’s why I wrote the program that way. One thing I didn’t understand was how you could be using up 126 bytes of Scratch Pad RAM? You mentioned it was full. What do you have stored there? On a BS2p that is the easiest way to get a long string serially…There is a special function that will drop it right into the SPRAM. Without it you would need an array sufficiently long enough, which, as discussed is not possible. You may want to consider revising your program to move 48 or so bytes of data out of the SPRAM somehow and use the beginning of SPRAM for a serial buffer.

    http://forums.parallax.com/showthread.php?p=626325

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • GeorgeGeorge Posts: 11
    edited 2007-01-25 19:17
    It will slow things down, but I can probably move the data out to EEPROM and restore it afterwards.
    Which special function are you referring to? Do you have an example?

    Thanks,
    George
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-01-25 20:22
    George,

    ·· What data do you currently have in the SPRAM? Is it using all 126 bytes? Here is an example of using the SPSTR modifier in the SERIN statement to capture a large string to the Scratch Pad RAM. This example grabs up to 65 characters from a GPS Module.
    SERIN GPS, Baud, [noparse][[/noparse]WAIT("GPRMC"), SPSTR 65]
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • GeorgeGeorge Posts: 11
    edited 2007-01-25 21:00
    My project is designed to have both a 4-channel and 8-channel version. For the 4-ch I use the BS2e, for the 8-ch I use the BS2p24.
    I am storing an 8 byte timer value for each channel in SPRAM (because there is not enough regular variable space available). I am also using another 7 bytes for passing variables between program slots.

    So while I have 56 bytes free on the 8-ch, I only have 24 bytes free on the 4-ch version. I can move the timers to SPRAM and restore them.

    In your example above, what would I use in place of "GPRMC"? (Since all email addresses don't end with ".COM".)
    or
    How can I detect the end of the address field? WAIT("") ?

    Thanks,
    George
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-01-25 21:16
    George,

    You don’t need the WAIT modifier in your application so you can remove it. Please look up the SPSTR feature under the SERIN command in the Help File or the BASIC Stamp Manual. You will see there is an optional termination character and you could use a 0 value if you wanted. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • GeorgeGeorge Posts: 11
    edited 2007-01-26 17:27
    When I hit the second line below, execution stops. Am I missing something? I tried adding a \CLS, but get a syntax error.
    George

    SEROUT pinkoutpin,pinkbaudrate,[noparse][[/noparse]"!NB0R52"] ' read email address from web page
    SERIN pinkinpin,pinkbaudrate,[noparse][[/noparse]SPSTR 48] ' get an address from webpage
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-01-26 20:36
    George,

    Apologies…Going between using SPRAM and using an array I got confused myself…You cannot put a termination character in the SPSTR command. Instead you can specify a relatively short timeout and exit in that manner. That is how the example in our PINK documentation works for the Emic TTS Module. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • GeorgeGeorge Posts: 11
    edited 2007-01-31 00:40
    Thanks for the help Chris.
    I've got it working now...
    George
Sign In or Register to comment.