PDA

View Full Version : Is there a label restriction



jblackann
- 8th December 2006, 14:50
Is there a label restriction that exists? I am working with the PIC16F687 and am getting errors that telling me that ID XXX is not a label. When I look in the code explorer thing, I am finding that the ID I am trying to use, e.g. XXX is showing up but I am still getting an error. I have made sure I do not have spelling errors. I have changed it to other labels but I am still having the problem. I am using PICBASIC Pro 2.46 and I just downloaded and installed the patch. I currently am trying to use 45 labels in my program. Thanks for your help.

mister_e
- 8th December 2006, 15:01
Unless you're using a reserved word, there's no label limit/restriction. Just make sure it's a label problem and not something else.

Yeah sometime the error messages have nothing to do with the REAL problem....

post your code here, we could spot it for you.

jblackann
- 8th December 2006, 15:22
Here is part of my code. This is for communication from one micro to another. I can't seem to find it. Thanks.

INITIATE_COMM VAR PORTA.2

SETUP_SERIAL_RECEIVE:
PAUSe 10
GOSUB SERIAL_REQUEST
TRISC = %01000000
PAUSE 10
LISTEN_RECEIVE:
BUTTON INITIATE_COMM, 1, 255, 0, C7, 0, RX -line 258, ID not Label
PAUSE 10
GOTO LISTEN_RECEIVE

SERIAL_REQUEST:
' request variable values
OUTPUT_DATA_REQUEST = 1 ' request other chip to communicate
BUTTON INITIATE_COMM, 1, 255, 0, C7, 1, RETURN -line 265, bad exp
PAUSE 10
GOTO SERIAL_REQUEST

RX:
OUTPUT_DATA_REQUEST = 0 ' turn off pin to send data
PAUSE 10
SERIN2 SERIAL_INPUT, 600, [WAIT("A"), BIN MODE] - line 272, bad exp

SETUP_SERIAL_TRANSMIT:
PAUSe 10
GOSUB SERIAL_REQUEST
TRISC = %01000000
PAUSE 10
LISTEN_XMIT:
BUTTON INITIATE_COMM, 1, 255, 0, C7, 0, TRANSMIT_DATA - line 280, bad ex
PAUSE 10
GOTO LISTEN_XMIT -line 282, ID not a label

TRANSMIT_DATA:
PAUSE 10

-------
Errors
ERROR Line 258: ID RX is not a label. (16F687 Controller w LCD v01.pbp)
ERROR Line 265: Bad expression. (16F687 Controller w LCD v01.pbp)
ERROR Line 272: Bad expression. (16F687 Controller w LCD v01.pbp)
ERROR Line 280: Bad expression. (16F687 Controller w LCD v01.pbp)
ERROR Line 282: ID LISTEN_XMIT is not a LABEL. (16F687 Controller w LCD v01.pbp)

mister_e
- 8th December 2006, 15:31
it will be hard without the whole variable definition but...


BUTTON INITIATE_COMM, 1, 255, 0, C7, 0, RX -line 258, ID not Label

how you defined C7 and RX?



BUTTON INITIATE_COMM, 1, 255, 0, C7, 1, RETURN -line 265, bad exp
RETURN is a reserved word.. you MUST use a label name where to jump. On this label you will use a return.


SERIN2 SERIAL_INPUT, 600, [WAIT("A"), BIN MODE] - line 272, bad exp

Shouldn't be a problem... and you know that 600 is not 600 bauds right?

jblackann
- 8th December 2006, 16:20
C7 VAR BYTE
Rx should be used as label and not used anywhere else.

I thought maybe I could use RETURN because I am doing a gosub to to jump into sub routine and then I want to exit that and return to what i was doing.

---------------
I decided not to try use the one piece of code as a sub-routine and fixed this by just with putting the code in twice. The problem disappeared. My program is huge and I was trying to be extra efficient. I think i am going to have to just go with a micro that has a larger memory. I am using a LCD with this application communicating serially. The code seems to be piling up quickly.

jblackann
- 8th December 2006, 16:34
I compiled my code for the 16F687 and saw that it came up to 2042 words and I am still not done writing. I thought I would migrate up to the 16F689 and the code size jumps to 2571 words. Is this because it now needs to go back and forth between memory pages.