This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

What's wrong with this code

Well my program is a car security system which detects intrusion ,fire,gas using 4 sensors and sends an sms via GSM modem. Given below is my code which is in BASCOM software which when compiled given numerous errors. CAn you tell me what could be the problem???
Also im using 89S52 microcontroller

$crystal = 11059200

Sw1 Alias P0.0
Sw2 Alias P0.1
Sw3 Alias P0.2
Sw4 Alias P0.3
Sw5 Alias P0.4

Led0 Alias P1.0
Led1 Alias P1.1
Led2 Alias P1.2
Led3 Alias P1.3
Led4 Alias P1.4

Bz Alias P3.6
Relay Alias P3.7

Main:

Led0 = 1
Bz = 0
Relay = 0

Led1 = 0
Led2 = 0
Led3 = 0
Led4 = 0

Read:

X =(q0)p0
X =(q1)p0
X =(q2)p0
X =(q3)p0

Select Case X(value)

Case 1:

Sms1:

Led0 = 0

Led1 = 1 Led2 = 0 Led3 = 0 Led4 = 0

Bz = 1 Relay = 1

Print "AT+CMGS=1,";

Waitms 100

Print "9967863284"; Wait 3

Print Chr(34)

Led0 = 1

Led1 = 0 Led2 = 0 Led3 = 0 Led4 = 0

Bz = 0 Relay = 0 Goto Read

Case 2:

Sms2:

Led0 = 0 Led1 = 0 Led2 = 1 Led3 = 0 Led4 = 0

Bz = 1 Relay = 1

Print "AT+CMGS=2,";

Waitms 100

Print "9967863284"; Wait 3

Print Chr(34)

Led0 = 1

Led1 = 0 Led2 = 0 Led3 = 0 Led4 = 0

Bz = 0 Relay = 0 Goto Read

Case 4:

Sms3:

Led0 = 0 Led1 = 0 Led2 = 0 Led3 = 1 Led4 = 0

Bz = 1 Relay = 1

Print "AT+CMGS=3,";

Waitms 100

Print "9967863284"; Wait 3

Print Chr(34)

Led0 = 1

Led1 = 0 Led2 = 0 Led3 = 0 Led4 = 0

Bz = 0 Relay = 0 Goto Read

Case 8:

Sms4:

Led0 = 0 Led1 = 0 Led2 = 0 Led3 = 0 Led4 = 1

Bz = 1 Relay = 1

Print "AT+CMGS=4,";

Waitms 100

Print "9967863284"; Wait 3

Print Chr(34)

Led0 = 1

Led1 = 0 Led2 = 0 Led3 = 0 Led4 = 0

Bz = 0 Relay = 0 Goto Read

End Select

Goto Main

End

  • "my code which is in BASCOM"

    Your most fundamental error, then, is in posting it to an entirely irrelevant forum!
    BASCOM is not a Keil product, is it?!

    See: http://www.keil.com/forum/

  • CAn you tell me what could be the problem???

    The problem could be that your program has syntax errors.

    I can tell you the problems of your posting more precisely:

    which is in BASCOM software

    1. BASCOM is not a Keil product. This is a forum about Keil products, not about '51 stuff in general.

    which when compiled given numerous errors.

    Without knowing what errors you get, how is anyone supposed to diagnose the problems without first getting BASCOM itself and then compiling your program ? "it gives numerous errors" is not useful information for diagnosis, and therefore will only yield answers that are correct, but not useful.

    3. You did not read the "Tips for posting messages", or you read and ignored them. They appear right above the box where you type in your posting, so they are almost impossible to miss. Following them is considered good etiquette and people are much more likely to help you if you do.

    http://www.keil.com/forum/tips.asp