Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.
"
 
Please post your code (with proper formatting).
 
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
data_ee_addrh = storeaddress.HB
data_ee_addr = storeaddress.LB

movlw data_ee_addrh ;
movwf EEADRH ;upper bits of data memory address To Read
movlw data_ee_addr ;
movwf EEADR ;lower bits of data memory address To Read
bcf EECON1,EEPGD ;point To data memory
bcf EECON1,CFGS ;ACCESS EEPROM
bsf EECON1,RD ;EEPROM Read
movf EEDATA,W ;W = EEDATA

storedata = EEDATA

Return

TI had used EEADRH and EEADRL for the upper and lower bytes for the address. By process of elimination they should be EEADRH and EEADR respectively - as above.

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

Thanks for your help , all.

I
 
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:
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.
 
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

  • 18F4680 Template Latest ASM Adjustment.bas
    10.1 KB · Views: 231
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.
 
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

  • 18F4680 Template Latest ASM Adjustment.txt
    10.1 KB · Views: 207
Look at your post and you may work out how [code] and [/code] tags work.

Mike.
 
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.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top