PDA

View Full Version : PICBASIC Pro examples will not compile????



N6VMO_
- 22nd July 2010, 20:11
My programming experience is small, but I have done Z80, 6502 and 68000 assembly
programming and Basic.

I am just starting out using PIC BASIC Pro and I find that the examples in the PBP manual and
MicroCode Studio Help will not compile correctly using MicroCode Studio. In the past, I have used the examples and samples to form a basis and learn, but when the examples and samples don't work, it becomes very frustrating.

I have used 'cut and paste' to minimize typos, but the code with not compile without syntax errors. This is driving my crazy. :(

My project is to read in a string of characters using HSERIN (this part I have working), then LOOKUP
the 10th character in the string and act upon the results.

What am I doing wrong?

Thanks,

John

ScaleRobotics
- 22nd July 2010, 20:21
What errors do you get?

Do you have any specific examples which do not compile for you?

mackrackit
- 22nd July 2010, 20:29
Welcome to the forum.

Not all examples work with all chips due to different ports and registers.
Which example and PIC are you using?

N6VMO_
- 22nd July 2010, 20:30
What errors do you get?

Do you have any specific examples which do not compile for you?


Right out of the MicroCode Studio Help:


FOR B0 = 0 TO 5 ' Count from 0 to 5
LOOKUP B0,["Hello!"],B1 ' Get character number B0 from string to variable B1
SEROUT 0,N2400,[B1] ' Send character in B1 to Pin0 serially
NEXT B0 ' Do next character

N6VMO_
- 22nd July 2010, 20:31
Welcome to the forum.

Not all examples work with all chips due to different ports and registers.
Which example and PIC are you using?

Thank you. I am enjoying the site.

I am using the 16F627.

John

ScaleRobotics
- 22nd July 2010, 20:48
Right out of the MicroCode Studio Help:


FOR B0 = 0 TO 5 ' Count from 0 to 5
LOOKUP B0,["Hello!"],B1 ' Get character number B0 from string to variable B1
SEROUT 0,N2400,[B1] ' Send character in B1 to Pin0 serially
NEXT B0 ' Do next character

You have to define your variables B0 and B1. Or you can add this include to your program. See page 24 ish of the manual.


Include "bs2defs.BAS"

FOR B0 = 0 TO 5 ' Count from 0 to 5
LOOKUP B0,["Hello!"],B1 ' Get character number B0 from string to variable B1
SEROUT 0,N2400,[B1] ' Send character in B1 to Pin0 serially
NEXT B0 ' Do next character

N6VMO_
- 22nd July 2010, 20:53
What errors do you get?

Do you have any specific examples which do not compile for you?

ERROR Line 26: ID CURHOME2 is not a LABEL. (9600 BAUD HSERIN LOOKUP EXAMPLE rev 1.pbp)
ERROR Line 33: Expected '['. (9600 BAUD HSERIN LOOKUP EXAMPLE rev 1.pbp)
ERROR Line 33: Expected ']'. (9600 BAUD HSERIN LOOKUP EXAMPLE rev 1.pbp)
ERROR Line 41: Expected ']'. (9600 BAUD HSERIN LOOKUP EXAMPLE rev 1.pbp)

As you can see, my LOOKUP routine even makes a LABEL (line 26) have a syntax error.

N6VMO_
- 22nd July 2010, 20:56
You have to define your variables B0 and B1. Or you can add this include to your program. See page 24 ish of the manual.


Include "bs2defs.BAS"

FOR B0 = 0 TO 5 ' Count from 0 to 5
LOOKUP B0,["Hello!"],B1 ' Get character number B0 from string to variable B1
SEROUT 0,N2400,[B1] ' Send character in B1 to Pin0 serially
NEXT B0 ' Do next character


OK, I will give it a try...and read a bit more too.

Thank you!

John