Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Sonsiviri PIC Basic Plus error

Status
Not open for further replies.

Beefer3

New Member
Can someone tell me why this does not work when compiling with PIC Basic Plus from sonsiviri.com

IF [STR SERDATA] = "HouseLights1" THEN
CLS
PRINT AT 1,1, "Turning on"
PRINT AT 2,1, "the house."
ENDIF


I get this error:

Error at Line [45] In file [SonyCD.bas] *** Misplaced or Incorrect 'ENDIF' command! ***

all my other IF THEN statements work in my code. I have a feeling it is the [STR SERDATA] bit. How do I fix this or is this just a PIC Basic Plus program error?

thanks
 
Get rid of the "THEN"

Using "Endif" indicates that you are excuting more then one command after the "If" statement.

Ex.

IF A>B THEN
Do One thing...

IF A>B
Do First thing
Do Second thing
.
.
ENDIF

Well that how basic language is, I'm not sure if the compiler you are using follow this rule.
 
thanks CoTang. I will give it a try
 
Are you sure you can compare strings? PICBasic Pro CAN'T :evil: so I just wonder if yours can.

Ivancho
 
CoTang
Thanks but getting rid of the 'THEN' did not work.

Does anyone know how to compare strings?

Maybe convert the IF THEN statement into assembly?

This has been a thorn in my side for my project.

If anyone has any suggestions let me know.

Thanks
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top