checking the serial data
kiran kumar palthi
Posts: 1
hello,
i am working on basic stamp2e for AROBOT. i would like to check the data(like 1010, 0001,... 4bit)·coming in to my board at pin number 2.
according to the data or command i have to movve my robot like if command is like 0010 then i hav to move my robot left like that.
i am getting the commands from a synapse board through a wire connected to the stamp board.
how to check the·data on pin 5?
Is i/opins of basic stamp are bit/nibble/word?????
thanq in advance for answering
i am working on basic stamp2e for AROBOT. i would like to check the data(like 1010, 0001,... 4bit)·coming in to my board at pin number 2.
according to the data or command i have to movve my robot like if command is like 0010 then i hav to move my robot left like that.
i am getting the commands from a synapse board through a wire connected to the stamp board.
how to check the·data on pin 5?
Is i/opins of basic stamp are bit/nibble/word?????
thanq in advance for answering
Comments
The SERIN statement receives data in this format and the SEROUT statement transmits data. Read the chapters in the Parallax Stamp Basic Syntax and Reference Manual on these commands for details of how they are used and examples of their use.
The Stamps have 16 I/O pins (except for the BS2p40) which each normally handle one bit of information. They can be grouped in 4-bit (nibble) groups where that's helpful and in 8-bit (byte) groups where that's helpful.
There's a nice tutorial ("What's a Microcontroller?") that goes into basics like how the I/O pins are used and the various statements available. All of this documentation can be downloaded from Parallax's website. Go to the main webpage, click on the Resources tab, then choose Downloads, then Stamps in Class Downloads and you'll see a list of tutorials along with links for downloading.
how to group those bits into nibble or byte ?
can u provide me example
Just in case you do not have the BASIC Stamp Syntax & Reference Manual, or did not know it is available, here is a link to downloadable pdf. format for your convenience.
BASIC Stamp Syntax & Refence Manual:
http://www.parallax.com/Portals/0/Downloads/docs/prod/stamps/web-BSM-v2.2.pdf
I hope this helps
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
If I understand the question correctly, you could use an IF...THEN statement.
For example, IF X = Y THEN (place some result here)
Where X could be a constant; while Y is a variable or value you want to comparing it to. You can review the IF…THEN command in the book referenced above for more details on how to use the IF…THEN command.
Feel free to ask more specifically if this is not what you meant.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
but i already tried that like
' {$STAMP BS2e}
' {$PBASIC 2.5}
t VAR Byte
m VAR Bit
i VAR Byte
main:
IF IN2=1 THEN
m=1
ELSE
m=0
ENDIF
t(i)=m
i=i+1
GOTO main
END
IF t="0000" THEN
HIGH 10
ENDIF
·but its giving an error at t="0000"
·
2) Your IF t = "0000" THEN doesn't make any sense. The quote is used to make a string in I/O statements and, for a single character, is used to specify a character constant. You probably want to use the "%" character which is used to start a binary constant or "$" which is used to start a hexadecimal constant. Read the section of the Basic manual on constants.
3) Why do you have the bit about IF t = "0000" THEN at the end of the source code. It won't ever be executed.
4) "t(i) = m" will not set individual bits of the variable "t". You probably want something like "t.BIT(i) = m". Please read the Basic manual as I've indicated.
You seem to need to learn basic programming skills. Please start with "What's a Microcontroller?" and work through the exercises. It'll help a lot.
As Mike suggested, completing What's A Microcontroller? and downloading the BASIC Stamp Syntax & Reference Manual will be a great help. Here is a link to What's A Microcontroller, and you can use the link above for the other manual.
What's A Microcontroller?
http://www.parallax.com/Portals/0/Downloads/docs/books/edu/Wamv2_2.pdf
However, if you wanted to get·both·books with the·materials reviewed in them, I suggest the·BASIC Stamp Discovery Kit. Once you have completed this educational text, you will have a good foundation to build on; having a hard copy of the Syntax Manual is really handy as well.
BASIC Stamp Discovery Kit [noparse][[/noparse] usb & serial ]:
http://www.parallax.com/Store/Microcontrollers/BASICStampProgrammingKits/tabid/136/CategoryID/11/List/0/SortField/0/Level/a/ProductID/320/Default.aspx
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com