Picbasic Pro Demo assembly errors
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
re: Picbasic Pro assembly errors
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
TRIS 1 = input, 0 = output
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