Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

error in bascom code

Status
Not open for further replies.

navlenikhil8

Newbie level 1
Newbie level 1
Joined
Mar 21, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,297
$large
Dim Addr As Byte
Dim Datain[addr] As Byte
Dim T As Byte
Dim F As Integer
Dim G As Byte
Dim S As Integer
Dim In As Byte
Dim Ind As String * 1

P2 = 255

$baud = 9600

P3.7 = 0
P3.6 = 0
P3.5 = 0
P3.4 = 0

Cls
Cursor Off
Lcd " Zigbee Based"
Lowerline
Lcd "Ind.Automation"
Wait 2

Cls
Lcd "S.E.S.G.O.I.F.E "
Lowerline
Lcd " "
Wait 2

Cls
Lcd "Guided By:prof: "
Lowerline
Lcd "Dr.Alam Shaikh "
Wait 2

Do

For Addr = 0 To 3

P1 = Addr
Waitms 1
P1.3 = 1
Waitms 1
P1.3 = 0
Waitms 1

Datain[addr] = 0

If P2.0 = 1 Then
Datain[addr] = Datain[addr] + 128
End If
If P2.1 = 1 Then
Datain[addr] = Datain[addr] + 64
End If
If P2.2 = 1 Then
Datain[addr] = Datain[addr] + 32
End If
If P2.3 = 1 Then
Datain[addr] = Datain[addr] + 16
End If
If P2.4 = 1 Then
Datain[addr] = Datain[addr] + 8
End If
If P2.5 = 1 Then
Datain[addr] = Datain[addr] + 4
End If
If P2.6 = 1 Then
Datain[addr] = Datain[addr] + 2
End If
If P2.7 = 1 Then
Datain[addr] = Datain[addr] + 1
End If

If Addr = 0 Then
T = Datain[addr]
Elseif Addr = 1 Then
F = Datain[addr]
Elseif Addr = 2 Then
G = Datain[addr]
Elseif Addr = 3 Then
S = Datain[addr]
End If

Next

Print "M1" ; T;
Print "M2" ; F;
Print "M3" ; G;
Print "M4" ; S;

Cls
Locate 1 , 1
Lcd "T=" ; T ;
Locate 1 , 9
Lcd "F=" ; F ;
Locate 2 , 1
Lcd "G=" ; G ;
Locate 2 , 9
Lcd "S=" ; S ;

In = Inkey

If In = "A" Then
P3.7 = 1
End If

If In = "B" Then
P3.6 = 1
End If

If In = "C" Then
P3.5 = 1
End If

If In = "D" Then
P3.4 = 1
End If

If In = "E" Then
P3.7 = 0
P3.6 = 0
P3.5 = 0
P3.4 = 0
End If

Waitms 250
Loop







Plz help me in solving error in above code
 

Attachments

  • image.png
    image.png
    153.3 KB · Views: 71

I assume you would like to use array.
Dim Datain[addr] As Byte this is invalid syntax.
Dim Datain(10) as byte is for 10 byte array.

for Addr = 1 to 10
Datain(addr) = inkey
next

I do not see config for serial port so I assume you are setting this in the IDE.
Typicaly I would see inkey() function with your serial port # inside like Inkey(#1) etc.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top