In-Ex Akit-BASIC Stamp2SX User manual

Akit-BASICStamp2SX : BASICStamp2SX Activitykit l1
1.KitContents
In standardpackage of Akit-BASICStamp2SXinclude:
1. i-Stampboard x1
2. AX-2SXactivityboard x1
3. CX-232 serialportcable x1
4. SLCD16x2 SerialLCD module x1
5. Uni-polar steppermotor x1
6. Documentation x1
7. CD-ROM x1
Torunthisactivitykityou’llneed:DCadaptor+9Vdc500mAorhigher
(maximum +16Vdc)
2. Kitfeatures
2.1i-Stamp microcontrollerboard
lWorkabilitiesarecompttiablewithBASICStamp2SXmodule(BS2SX-IC)
l50 MHzclockfrequency.Operateupto10,000 P-BASICcommand/second
l16KBytememory,separate8sections,2KByte/each,erasable100,000+times
l32 byteRAMwith64 byteScratchpadRAM
lConsumption 65mAinfull operation and200mAinsleepmode
lConnectingtoPC’sserialportforprogramminganddebuging
l16 I/O,freedomseparetedworkorsetingroupsfrom4,8and16 pins
l30mA/30mAsource/sinkcurrent. Maximum60mA/60mAsource/sinkcurrentper
8-pinsgroups(P0-P7/P8-P15)
lI/OpincandriveLED (withcurrentlimitresistor) and6Vservomotordirectly
lLED power status
lBoardsizes1.7"x1.2"
lDevelopwithBASICStampEditorprogram
Akit-BASIC Stamp2SX
BASICStamp2SX/i-StampmicrocontrollerActivityKit

2lAkit-BASICStamp2SX : BASICStamp2SXActivitykit
2.2AX-2SX Activtyboard
lSupporti-Stamp
lIn-systemprogrammingandDebuggeingviaserialport
l8-LED display
lRelaydriver withrelay12V
lUni-polarStepper motordriver share withLED on P0-P3ofi-Stamp
lVoice-coil 8Wspeaker
lLDRlightsensorwithRCcircuit
l4-Pushbutton switchwithresistorpull-up
lSerialinterfaceconnector(P15)
lUsewithDC adapter 12V500mA(notincluded)
lPolarityprotection circuit
2.3SLCD16x2 SerialLCD
lLCD 16 characters2lines
lSerialInputRS-232 orInvert/Non-invertTTL/CMOS logiclevel.
l28 byteFIFObuffer, baudrate2400 or9600 bpsselectable, 8bitdata,no parity,
1stopbit.
l1/8 or1/16 Dutycanbeselectedbyjumper.
lScott Edwards'sLCD SerialBackpack®commandcompatibleaddition with
ExtendedCommandthatmakeLCD controleasier.
lEasytointerfacewithmicrocontroller suchasBASICSTAMP®.
lOperation with5to12 V.DC supply(5.1V.zener build-in)
3.Introductiontoi-Stampmicrocontroller
i-Stamp istheemulatorofBS2SX-ICmodule whichdesignedbyInnovativeExperiment
Co.,Ltd., Thailandunder co-operativewithParallaxInc., manufacturer BASICStampfrom
USA.
ThesizeissimilattoBS2SX-ICandcanputon 24 pinssocket.i-StampuseBASICStamp
interpreter liciencedbyParallaxInc.. Somakesure thati-Stampabilityiscompattible.
Figure 2,showsi-Stampschematic.It’ssimilartoBS2SX-IC.Theonlyonedifferentisi-
Stampno Vinpinbecauseinsidei-Stamphasnot+5Vregulatorcircuit.

Akit-BASICStamp2SX : BASICStamp2SX Activitykit l3
PIN NAME FUNCTION
Tx/SOUT1 Serial Out:
connects to PC serial portRXpin
(DB9pin2)forprogramming.
Rx/SIN2 Serial In:
connects to PC serial portTXpin
(DB9pin3)forprogramming.
ATN3 Attention:
connects to PC serial portDTRpin
(DB9pin4)forprogramming.
VSS/GND4 System ground: (same aspin23)
connects to PC serial portGND
pin(DB9pin5)forprogramming.
P0-P155-20 P0-P15 General-purposeI/Opins
+5V21 5-voltDC input
RES22 Resetinput/output:goeslow
Vss/GND23 System ground
N/A24 Notuse
i-Stamp
24
23
22
21
20
19
18
17
16
15
14
13
GND
RES
+5V
P15
P14
P13
P12
P11
P10
P9
P8
TX
RX
ATN
GND
P0
P1
P2
P3
P4
P5
P6
P7
1
2
3
4
5
6
7
8
9
10
11
12
Figure1-1 i-Stamp’sPinassignmentandfunction
i-Stampboardsizeis
1.7x1.2 Inches
TheheartofcircuitisIC1whichSX-28ACmicrocontroller.Insidethismicro
controller containsP-BASIC2SXinterpreterfirmwarer.TheusershavealreadywrittenP-BASIC.
Theprogramisdownloadedintoi-Stampviaserialport. SignelisconvertedtoTTLlevelby
R2-R10 andQ1-Q3.Q1sendsdatafromIC1toPC’sserialportviapin2(RxD).Q2converter
inputleveltosendtoIC1.Q3useforreceivingresetsignalfromcomputer toresetIC1.It
meansresetsystemtogether.However,theuserscanresetthesystembyexternalswitch
whichconnecttoRESETpin.
OpearingprogramsavetoIC2whichis16KByteserialEEPROM24LC128.Itmeans
IC2isthesystemmemory program. Ifit’snotcorrect,IC1will noticetotheusersknowthe
result.
IC1receiveclocksignalfromCR150MHzceramicresonator.i-Stamp’sportuse
IC1’spin10-25.ItcallsP0-P15 insteadfordefindingeasier.
i-Stampneed+5Vandatleast65mAsupplyfromregulator.Forreducingboardas
small aspossible,itexcludepower supply.Theusersjustconnect+5Vandgroundtoi-
Stampandworkon it.

4lAkit-BASICStamp2SX : BASICStamp2SXActivitykit
4. InsideAX-2SXBASICStamp2SXActivityboard
AX-2SXistheactivityboardthatprepare manyexternalcomponentstointerface
withi-Stamp microcontrollerforlearningandexperiment.You caninterfaceallcomponents
veryeasy.WithsimplePBASICprogrammingcanhelpyouunderstandingabout
microcontroller interfacingconcepts.
Figure 3showsthephysicalofAX-2SXboardandschematicshowninfigure 4. SK1is
24-pinfemaleIDCsocketisusedforsupporti-Stamp.+5Vregulatedvoltagesupplyis
connectedtopin21 ofi-Stamp. Atpin22 connectwithRESETswitchtoresettheoperation
ofi-Stamp. Forinterfacingwithserialport,usepin1to4connectwithpin2,3, 4and5ofDB-
9serialconnector.Theseinterfaceare usefordownloadinganddebuggingviaDebug
TerminalinBASICStampeditorsoftware.
Thedetail ofeachinterfacingcircuiton AX-2SXboardcandescribeas:
i-Stamp
RS-232
DOWNLOAD
OFF
P7P6P5P4P3P2P1P0
STEPPER
MOTOR
LDR
RELAY
P13
RELAYOUT
P11 P10 P9 P8
SERIALDATA
+5V.
P15
GND
SWITCHINPUT
P12
SOUND/FREQ.
OUTPUT
P14
RC-PORT
AX-2SX
BASICStamp
ACTIVITY
BOARD
LED OUTPUT
RY.
RESET
DCINPUT
ON
NC
C
NO
Figure3AX-2SXboardoverlay; eachinterfacecircuitwithi-Stampwill detail.
Suchas8-LEDoutputslabelwithP0toP7portpinofi-Stamp.

Akit-BASICStamp2SX : BASICStamp2SX Activitykit l5
+5V
C5
47/16V
IC2
7805
C3
220/25V
J1
DC INPUT
9-12V
C6
0.1/50V
C4
0.1/50V
D1-D4
1N4001 x4
K5
DC
INPUT
+
-
S6
ON/ OFF
24
23
22
21
20
19
18
17
NC
GND
1
2
3
4
5
6
7
8
RxD
ATN
GND
TxD
9
10
11
12
16
15
14
13
K1
DB-9
FEMALE/PCB
DOWNLOAD
2
3
4
5
6
7
RST
+5V.
P15
P14
P13
P12
P11
P10
P9
P8
P0
P1
P2
P3
P4
P5
P6
P7
R1-R8
470
LED8-LED1
PHASEA toDCOIL
D ABC
+V
NC
COM
NO
S5
RESET
+5V
S1-S4
R9-R12
220
SP1
SPEAKER
+5V
RP1
4k7*4
LDR1
C2
0.1mF
50V
+5V
P15
+5V.
GND
4 3 2 1
9
16151413 10
7
8
K2
STEPPER
MOTER
IC1
ULN2003
+V
SK1
i-Stamp
R13
1k5
LED9
RY
STEPPERMOTER
RY1
RELAY12V
K3
RELAY
OUTPUT
K4
SERIAL
DATA
R14-R15
220
R15
C1
10mF50V
R14
CONTACTRATING
250V 5A
+V
Figure4AX-2SXboardschematic
4.18-LEDoutputs
All 8-LEDswill be connectedwithP0toP7ofi-Stampviacurrentlimitresistor.All LED
wil operateatLogic“1” oractivehigh.
4.2Steppermotordriver
AtP0toP3ofi-Stampshare withdriveLED andconnectwithULN2003 driver IC.
ULN2003 willbeusefordrivingauni-polarstepper motor. ULN2003 contains7open-collector
inverter.ItsinpurcanacceptTTLlogicandoutputcandrivehighcurrentloadover +5V.
Maximumis+30V500mAper output.InAX-2SXwill connectwithauni-polarstepper motor.
Themotorsupplyvoltage getsfromDC adaptor.
Drivingthestepper motorisnotdifficult. Sendd logic“1” fromi-Stampport(P0-P3) to
inputofULN2003.After thatULN2003 will invertlogicto“0”.Itcausethecurrentdrawinto
themotor’sphasethatconnectwithULN2003 output.Theshaftofmotorwill spinone
step.Ifall phaseare receivedthecontinuoussignal,stepper motorspinscontinuous.

6lAkit-BASICStamp2SX : BASICStamp2SXActivitykit
4.3Sounddriver
AX-2SXboardprovidesa100mW8Wspeaker andconnectwithP12ofi-Stamp.i-
StampcanouttheaudiosignalcoupleviaC2;10mF capacitortodrivethisspeaker.This
circuitdemonstratethei-Stamp’sperformanceaboutdrivingasmall speakewithout
externalamplifier circuit
4.44-Inputswitches
AtP8toP11are assignedtoInputports.Theyareconnected4ofpush-button
switchesandconnected4pull-upresistortodefinelogic“HIGH”innormalstate.Ifany
swithispressed, thatportwill beconnectedtoground. Logic“0” will appliedatthatport.
i-Stampcanreadport’statuswithprogramming.
Addition atP8toP11 haslimit-currentresistor220W(R9toR13) forprotectingi-Stamp’s
port.Normallyi-Stamp’sportcanconnecttoGrounddirectlybutmustsettoINPUTonly.
TheR9toR13 are usedtoprotectportdestroyincasesettinganyporttooutputand
switchispressed.Ifnotprotected,i-Stamp’sportwill bedestroy.
4.5Relay driver
P13 ofi-StampisconnectedwithULN2003 input(pin7).OutputofULN2003 (pin10)
isconnectedwith12Vrelay. i-Stampcanactivetherelayoperation withsendlogic“1” to
pin7ofULN2003.ULN2003 will invertlogictoactivaterelay.Relay’scoil havecurrent
draw.LED9lightsuptoindicatestheoperation andrelaycontactwill switchfromNCto
NO.Relaycontactratingis220Vac5Aandsuitabletodrive600Welectricload.User can
connecttheelectricapplianceloadtocontrolledbyi-Stamp.
4.6LDRcircuit
Onefeature ofi-Stampisthesimpleanalogsignalprocessingwithspecialcommand;
RCTIME.ThiscommandconceptisRCtimeconstantoperation.InAX-2SXboard,useLDR
(LightDependentResistor)and0.1uFcapacitor.They are connectedtoP14 ofi-Stamp.
R14 resistorisconnectedwithP14 inseriesfor2purposes.OneisassistancetheRC
operation start.Another function iscurrentlimitation fromreversecurrentofcapacitor
rechageing.
4.7Serialinterface port
AX-2SXboardassignP15 ofi-Stamptoserialcommunication porttoextension.The
externaldevicethatconnectatthisportmusthaveserialcommunication suchasthe
SerialLCD,SerialkeypadorSerialRealtimeclockmodule.Serialinterfaceconnectoruse
3-pinsheader.Theassignmentportfromleftis+5V,P15 orsignalandGround.Sameany
previousport,P15 hasacurrent-limitresistorforprotection.

Akit-BASICStamp2SX : BASICStamp2SX Activitykit l7
Theserialcommunication devicethatrecommendedforAX-2SXincludeSLCD16x2
SerialLCD (includedthisactivitykit),ZX-44 SerialKeypad4x4andZX-SERVO16 Servocontroller
board.
4.8Powersupply
AX-2SXboardcangetthevoltage supplyfrom2ways;fromDC adaptorjackK2
andTerminalblockK3. DiodeD1toD4connectasbridge rectifier circuitforpreparingthe
polarityofvoltage supply.ThiscircuithelpAX-2SXboardsupportall DC adpator’spolarity.
C3capacitorisusedforfilteringtheinputsupplyvoltage more smoothandC4capacitor
reducethehighfrequencynoise.Voltage atthispointiscalled+V.ItisusedforStpper
motordriveandRelaydriver circuit.
+Vvoltagewill beregulatedto+5VwithIC27805.At7805 outputconnectC5
capacitorfortransientresponseoperation.
5. Softwaretools
i-Stampcanworkon AX-2SXboardwithBASICStampeditorsoftware V2.2.6orhigher.
Downloadfree ofcharge at www.parallax.com.
User cansee thesoftware installation,howtouseandPBASICcommandreference
fromBASICStampeditormanualV2.0orhigher.Free downloadat www.parallax.com.

8lAkit-BASICStamp2SX : BASICStamp2SXActivitykit
Activity1: Getting startwithAkit-BASICStamp2SX
Purpose
Introducetohowtousei-Stampmicrocontroller boardwithAX-2SXActivityboard
andhowtointerfacewithcomputer.
Partlist
1.i-Stamp
2.AX-2SXActivityboard
3.CX-232 Serialportcable
4. Personalcomputer thatinstall BASICStampEditorV2.2.6orhigher andafree serialport.
Ifcomputer providesonlyUSBport,require USBtoRS-232 serialportconverter.TheUCON-
232Sisrecommended.
Procedure
1.1Puti-Stamp into24-pinfemaleheader onAX-2SXActivityboard.Mustputtheright
direction followinginfigure A1-1.
1.2ConnectserialportcablebetweenPC’sserialportandAX-2SXboardFollowingthe
figure A1-2.IfuseUSBtoSerialportconverter,mustconnecttheconverter withUSBport
andconnecttheserialportcablebetweentheconverter andAX-2SXboardinstead.
FigureA1-1 Show thefittingi-StampintoAX-2SXActivityboard
Fiti-Stampon24-pinfemale
headeronAX-2SXboard.The
concavesidemustturnto
theleftsideoftheactivity
board

Akit-BASICStamp2SX : BASICStamp2SX Activitykit l9
FigureA1-2 InterfacingofAX-2SXActivityboardwithcomputer’sserialport
i-Stamp
RS-232
DOWNLOAD
OFF
P7P6P5P4P3P2P1P0
STEPPER
MOTOR
LDR
RELAY
P13
RELAYOUT
P11 P10 P9 P8
SERIAL DATA
+5V.
P15
GND
SWITCHINPUT
P12
SOUND/FREQ.
OUTPUT
P14
RC-PORT
AX-2SX
BASICStamp
ACTIVITY
BOARD
LEDOUTPUT
RY.
RESET
DCINPUT
ON
NC
C
NO
ายเชื่อมตอ
พอรตอนุกรม
ดานตัวผู
ายเชื่อมตอ
พอรตอนุกรม
ดานตัวเมีย
ตอไปยังพอรตอนุกรม
ของคอมพิวเตอร
1
6
2
3
4
5
7
8
9
16
2
3
4
5
7
8
9
คอนเน็กเตอร DB-9 ตัวเมีย
คอนเน็กเตอร DB-9 ตัวผู
ายมัลติคอร 9 เน
1.3PlugDC adaptorforapplyingthesupplyvoltagetoAX-2SXActivityboard.Open
BASICSTampEditorsoftware.
1.4Checkthecommunication betweeni-StampandBASICStampEditorsoftware bypress
CtrlIkey orclickatIdentifybutton orenter RUNmenuthenselectIdentify
Ifallcorrect,Identificationboxwill appearandinformtheversion of
PBASIC2SXchipfollowingthefigure A1-3.ObserveCOM1box,itwill showBASICStamp2SX
V1.x(xisanynumber).Nowi-StampcanconnectwithBASICStampEditorsoftware.
1.5Makethesimpleprogramtotesting.
1.5.1SelectBASICStamptypebyBASICStampdirective. Enter Directivemenuand
selectStamp àBS2SXfollowingfigure A1-4. Themessage ‘{$STAMPBS2SX} appearson first
line.Press Enter key.
1.5.2Still stayatDirectivemenu.SelectserialportbyPort àCom1(oranyCom
portthatconnect)followingfigure A1-5.Messge ‘{$PORT COM1} will appearatsecond
line.Pess Enter.

10 lAkit-BASICStamp2SX : BASICStamp2SXActivitykit
FigureA1-3Displaytheidentification
ofPBASIC2SXfirmwareoni-Stamp
board.If connect completeatDevice
Typecolumnmustshownameof
BASICStampandVersion. FigureA1-4SelectionBASICStamp
directive.(select BS2SX)
1.5.3AtDirectivemenu,selectversion ofPBASIClanguage byPBASICàVersion2.5
followingfigure A1-6.Message ‘{$PBASIC2.5} appearatthirdline.Press Enter
1.5.4Atprogrammingarea,type debug“welcome”.Thisshortcodei-Stampsend
massage welcome todisplayon DebugTerminalofBASICStampEditorsoftware.Press
Enter.
1.5.5ClickRunbutton.DebugTerminalwill appearsandshowmessage “welcome”
on thescreenfollowingfigure A1-7
1.5.6Press RESETswitchon AX-2SXboard.Programwill showthesamemessage at
Termialsceen.BecauseRESETswitchpressingmeansre-starttheprogramrunning.
1.5.7Ifdialogueboxinfigure A1-9appears, itmeans Thecommunicationbetween
computerandi-Stamp fail.Check theserial portcableandfree statusof serial port. Inthe
figure A-10 showserialportcableconnection diagram.
FigureA1-5 Shows“How toselect and
usePortdirective” .
FigureA1-6Shows“Howtoselect
PBASIC2.5directive”.

Akit-BASICStamp2SX : BASICStamp2SX Activitykit l11
FigureA1-8 TheDebugTerminalscreenshow thetestingmessagewelcome.
Itmeansi-Stampcanworkready.This terminalwill appear everytimethat
useDEBUGcommand.
1.6All experimentPBASICcodecanstore in.bsx filename.
FigureA1-9 showsError boxonscreen. Itmeanssoftwarecannotdetect i-
Stamp.Mustback tocheck serialportcableagainandcheck FREE serialport

12 lAkit-BASICStamp2SX : BASICStamp2SXActivitykit
Table of contents
Popular Microcontroller manuals by other brands

Advanced Navigation
Advanced Navigation Spatial FOG Dual ETH Reference manual

Microchip Technology
Microchip Technology STK600 user guide

GigaDevice Semiconductor
GigaDevice Semiconductor GD32330F-START user guide

sparkfun
sparkfun Qwiic GPIO HOOK-UP GUIDE

Phytec
Phytec i.MX6UR manual

EMTRION
EMTRION VERNO-4 quick start guide