PDA

View Full Version : Picbasic Pro Demo assembly errors



mikeRho
- 31st December 2007, 04:26
Hi Everyone,

After trying to go the MPLAB assembly language route with complete frustration, I have purchased the melabs U2 programmer and downloaded the Picbasic Pro Demo version (to start out with). I am trying to program a PIC1684A (yes, it's on the Demo Supported Device List) with the following code:

TRISB = %11110000 'set portB pins 4, 5, 6, and 7 as outputs

'define ports as variables
Q1 VAR PORTB.4
Q2 VAR PORTB.5
Q3 VAR PORTB.6
Q4 VAR PORTB.7

'set each pin (portB 4 - 7) HIGH for 25ms in succession and loop
loop:
high Q1
pause 25
low Q1
high Q2
pause 25
low Q2
high Q3
pause 25
low Q3
high Q4
pause 25
low Q4
goto loop

I get the following errors:
Error PROGRAM1.MAC 6:[236] label 'rst?rp' undefined in pass 0
Error PROGRAM1.MAC 6:[226] numeric constant or symbol name expected
Error PROGRAM1.MAC 9:[236] label 'label' undefined in pass 0
Error PROGRAM1.MAC 14:[224] endm directive only for use in macros
Error PROGRAM1.MAC 17:[236] label 'label' undefined in pass 0
Error PROGRAM1.MAC 18:[224] endm directive only for use in macros
Error PROGRAM1.MAC 21:[236] label '1' undefined in pass 0
Error PROGRAM1.MAC 22:[236] label 'regin' undefined in pass 0
Error PROGRAM1.MAC 22:[236] label 'bitin' undefined in pass 0
Error PROGRAM1.MAC 23:[224] endm directive only for use in macros
Error PROGRAM1.MAC 23:[300] too many errors

Mind you, the program got through the compile. It was when the assembly was being read that the errors started. I don't know enough about assembly to have a clue what is going on. OK - the questions:

1) Am I running up against some restriction in the demo?
2) Could my syntax be wrong somewhere (although I don't think it would have gotten past the compiler!)?
3) Is there some wierd bug I don't know about? (I'm running an Athlon XP +3200 with WinXP SP2-pretty standard it would seem)

I will appreciate any help I can get.

Thanks! :-)

Mike

mister_e
- 31st December 2007, 06:02
that's strange indeed, using full-PBP don't return any error here...

so i've downloaded and installed the demo on one of my machine, launched MicroCode studio which comes with, pasted your code in, point the compiler to PBPDemo folder.. no error at all.

Now using MPASM as assembler... not much error.

Using MPLAB and MPLAB plug-in... no error at all.

Well, what may i suggest now :eek:

I'm really happy to see that MicroCode Studio DEMO AND FREE version install EasyHID while the ol' black but PAID version don't... really nice :(

Acetronics2
- 31st December 2007, 09:32
Hi,

That line is "not so good" ...

<< TRISB = %11110000 'set portB pins 4, 5, 6, and 7 as outputs >>

but as HIGH and LOW commands turn pins as they should be ...

reminder: 0 for Output 1 for Input ...


No compiling problems for me nor ...



did you try to re-load PbP and MPLAB / OR MCS to their default directories ??? ... did you verify the MPLAB/PBP Paths ??? ...

see here : http://melabs.com/support/mplab.htm

Alain

mikeRho
- 1st January 2008, 02:12
OK, now I feel really stupid. I did not have the assembler installed! I thought I had done that, but hadn't.

I really appreciate your replies mister_e and Acetronics.

Works like a charm now, but I'm sure I'll have some more tight spots.

Thanks again,

Mike

BrianT
- 1st January 2008, 03:04
There is an error in the code that is masked by your HIGH & LOW commands later on.

TRISB = %11110000 sets port bits 7-4 as INPUTS and port bits 3-0 as OUTPUTS. This is opposite to what you are trying to do.

The HIGH xxxx and LOW xxxx over ride the TRIS statement and force the selected pin to an output. If you later need more code space and use Portb.7 = 1 instead of HIGH PortB.7 to save a few bytes it will all crash.

In the current implementation you do not need the TRISB statement so either fix it or scrap it.
You can reduce code size by using the TRISB statement followed by
PortB.n = 1 or PortB.n = 0

HTH
BrianT

mikeRho
- 2nd January 2008, 06:41
Hi BrianT,

I guess you didn't read the post by Acetronics who told me (essentially) the same thing -problem corrected, thank you very much. In addition, I had replied back to my own post and said "Works like a charm now". Given that, why did you think I hadn't gotten it fixed - that is, unless you hadn't realy read the entire thread!

Don't get me wrong, I appreciate the help, but I usually need to be told only once (unless it's by my wife - she says it takes her telling me three times before it really sinks in!)

Anyway, thanks!

Mike