Shop OBEX P1 Docs P2 Docs Learn Events
SERIN command — Parallax Forums

SERIN command

ToreTore Posts: 2
edited 2007-10-21 19:11 in BASIC Stamp
Hi. I try again.

Are there anyone who can give me some feedback on this project. (Schematic or code)

I just want to read som data into the BS2. And if this data is correct i HIGH 10 to read out the result. OK or NOT OK.


'·· {$STAMP BS2}
'·· {$PBASIC 2.5}


T9600·····CON···· 84
buf········ VAR···· Byte(10)
char······· VAR···· Byte
RX········· PIN··· · 0························· 'Pin 0 if i use SIN pin on BS2 or 14 if i use I/O pin 14.

LOW 10

main:
SERIN RX, T9600, [noparse][[/noparse]WAIT("A"), STR buf\10]······ 'Put the recieved number "0002746012" into "BUF"

IF buf = "0002746012" THEN
· HIGH 10
ELSE
· LOW 10
END IF
GOTO main

Will this code be any good and is it best to use SIN or a I/O pin if you look at the attached shema ?

Is it possible to do this as simple as this?


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tore Grønås
719 x 280 - 19K
719 x 280 - 22K

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-10-20 23:11
    I would strongly suggest dropping the power supply voltage. 24V is within the voltage limits of the regulator on the Stamp, but there's no heatsink other than the substrate and the regulator will shut down due to overheating. There's a 19V drop across the regulator. It would only take a 20ma current drain from the output pin to cause about 1/2 watt of excess heat in the regulator. The best thing to do would be to use an external regulator, either a small switching regulator or a linear regulator with a small heatsink.

    Reading the numeric string into the buffer would work, but there is no string comparison. You can use the DATA statement to store one (or more) strings in the EEPROM where the program is stored, then use a loop to read characters one at a time (using the READ statement) and comparing them one at a time with the received string.
  • ToreTore Posts: 2
    edited 2007-10-21 19:11
    Thanks a lot Mike

    I will go down to 9 volt on supply voltage and it seams like i can use the code for RFID.bs2. Then i will try this on work monday.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tore Gr
Sign In or Register to comment.