# Assembler errors

Status
Not open for further replies.

#### John Thompson

##### New Member
I am using a Pic 18F4680 as a surrogate to debug programs (Other Pics don't work properly with the 18FKeys8 program). The 18F4680 does not accept READ and WRITE instructions. So I created Assember routines for this by cut & paste from the 18F4680 datasheet on the subject.

These compile ok (or so it seems) but when compile & assemble is used assembly is not successful. The error list refers to line numbers that do not correspond with line numbers in the .asm file, the .bas file or line lumbers in the editor reading the .asm file.

Examples of the errots are :
Line 461: movlw: 0x003 Error: Unrecognized instruction.
Line 463: ASM:movwf: EEADRH Error: Unrecognized instruction.

Yet these instructions are direct from the datasheet.

Can anyone shed light on this? Bot the line number question and why apparently standard assembler instructions are showig as errors.
"

#### jjw

##### Member
The colon after the move instruction is the error.
movlw: 0x003 should be movlw 0x03

#### John Thompson

##### New Member
I should have said the example errors were copied from the compiling error report. That report inserted the colon. There is no colon in the original program.

In the meantime I have cured the problem.

Code:
A section of the ASM code is:
'Set data and location for assembly routine

bcf EECON1,EEPGD ;point To data memory
bcf EECON1,CFGS ;ACCESS EEPROM
movf EEDATA,W ;W = EEDATA

storedata = EEDATA

Return

The problem has gone, and the program compiles and assembles without error now.

Thanks for your help , all.

I

#### Pommie

##### Well-Known Member
The colons may be the problem but as the OP seems to be using some kink of compiler with inline asm, it may not be. The instruction movwf is incorrect - it should be movw xxxx,f but most assemblers accept the shortcut.

We need to see code.

Mike.
Edit, I've obviously forgotten assembly - above in completely wrong.

Last edited:

#### Les Jones

##### Well-Known Member
It will be using ASM: as a location label. It may be OK to use it once but if it is used again it will be trying to asign the label ASM: to a different program address.

Les.

#### John Thompson

##### New Member
Attached is the code. It is a template only, so there is no "program" code. The compiling error was present when this template compiled so for the current purpose no program code should be needed. The ASM "cut and paste" code came from the Pic18F4680 datasheet, page 107

#### Attachments

• 10.1 KB Views: 21

#### DerStrom8

##### Super Moderator
It would be better if you post the actual code within [code][/code] tags here on the forum, or at the very least upload a text file.

#### John Thompson

##### New Member
DerStrom8

I apologise for my misunderstanding on how best to post code on this forum. I tend to treat .bas files and .txt files as "text" files. So, attached the template file as a .txt file.

Also I am not familiar with
Code:
tags. Could you pplease point me to an explanation on this site (or anywhere else) so I can get it right next time.

#### Attachments

• 10.1 KB Views: 7

#### Pommie

##### Well-Known Member
Look at your post and you may work out how [code] and [/code] tags work.

Mike.

#### DerStrom8

##### Super Moderator
DerStrom8

I apologise for my misunderstanding on how best to post code on this forum. I tend to treat .bas files and .txt files as "text" files. So, attached the template file as a .txt file.

Also I am not familiar with
Code:
tags. Could you pplease point me to an explanation on this site (or anywhere else) so I can get it right next time.
No need to apologize, sometimes it takes time to learn how sites work. I don't hold that against you

The [code][/code] tags work just as you would expect - paste your code between the opening [code] tag and the closing [/code] tag, and it will keep your formatting (tabs, spaces, etc). It just makes it easy to see and read your code without the format being messed up (as it would be if you simply pasted your code in the editor window without the tags) and without having to download a file. Simply put it makes everything easier on your readers.

Forum Supporter