Click on
diagram
for
better
view
'--------------------------------------------------------------
' file: Test2313.BAS
' demo: Test2313, HEX
' DLC 5/28/2001
'--------------------------------------------------------------
Dim A As Byte , B1 As Byte , C(3) As Byte
Dim L As Bit
Config Portd = &B0010010
'PD0 = RxD, Input
'PD1 = TxD, Output
'PD2 = IRPDR, Input
'PD3 = IRPDL, Input
'PD4 = LED, Output
'PD5,6 = Inputs
Print "Testing TTT 90S2313 Robot board"
Print "Now working the SSC chip"
'PortB.3
Open "comb.3:2400,8,n,1" For Output As #1
Printbin #1 , 01
Wait 1
Printbin #1 , 31
Wait 1
Printbin #1 , 63
Close #1
Print "Now checking IRPD"
For A = 1 To 10
B1 = Pind And &H0C
Rotate B1 , Right , 2
Print B1
Wait 1
Next A
Print "Toggling the LED Now"
For A = 1 To 10
Portd.4 = Not Portd.4
Waitms 200
Next A
Print "Now checking out the MCP3202"
'Configure for SPI
Config Spi = Soft , Din = Portb.6 , Dout = Portb.5 , Clock = Portb.7
Config Pinb.4 = Output
Portb.4 = 0
Spiinit
'Tell 3202 to do a reading
A = &B00001100
For B1 = 1 To 20
Portb.4 = 0
Spiout A , 1
Spiin C(1) , 2
Portb.4 = 1
C(3) = C(1)
Shift C(1) , Right , 4
Shift C(2) , Right , 4
Shift C(3) , Left , 4
C(2) = C(2) Or C(3)
Print C(1) ; " " ; C(2)
Wait 1
Next B1
Print "Completed"
End
|