PDA

View Full Version : Migrating to MPASM



Luckyborg
- 13th August 2009, 15:46
I switched over to MPASM several months ago when I started using an 18F4520. I'm going back to some of my other code that needs an update and am having trouble with a 16F631. I have commented out the config lines in the inc file. I get "Error[113] c:\pbp\pbppic14.lib 5985 : Symbol not previously defined (EEPGD)"

After stripping down the code I have isolated the error to anytime I use a read or write statement. If I switch back to PM all is well.



define osc 8
Clear

'@ device pic16F631, INTOSCIO, wdt_on, pwrt_on, MCLR_OFF, protect_on, IESO_OFF
@ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _IESO_ON

OSCCON = %01110101 'set internal osc on to 8 mhz


Prev_Baud var byte


ANSEL = 0 'set port to digital
OPTION_REG.7 = 0 'enable pull ups on A and B


read 0, Prev_Baud
if Prev_Baud > 4 then 'don't allow anything over 19200, default to 9600
write 0, 3
endif

Pause 1000

main:

goto main

End


Any ideas? I would rather not have to always switch back and forth depending on which chip I'm using. I uninstalled and removed MPASM and installed the newest version already.

David

Archangel
- 13th August 2009, 21:51
I switched over to MPASM several months ago when I started using an 18F4520. I'm going back to some of my other code that needs an update and am having trouble with a 16F631. I have commented out the config lines in the inc file. I get "Error[113] c:\pbp\pbppic14.lib 5985 : Symbol not previously defined (EEPGD)"

After stripping down the code I have isolated the error to anytime I use a read or write statement. If I switch back to PM all is well.



define osc 8
Clear

'@ device pic16F631, INTOSCIO, wdt_on, pwrt_on, MCLR_OFF, protect_on, IESO_OFF
@ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _IESO_ON

OSCCON = %01110101 'set internal osc on to 8 mhz


Prev_Baud var byte


ANSEL = 0 'set port to digital
OPTION_REG.7 = 0 'enable pull ups on A and B


read 0, Prev_Baud
if Prev_Baud > 4 then 'don't allow anything over 19200, default to 9600
write 0, 3
endif

Pause 1000

main:

goto main

End


Any ideas? I would rather not have to always switch back and forth depending on which chip I'm using. I uninstalled and removed MPASM and installed the newest version already.

David
Hi David,
I cannot duplicate the error, I copied and pasted your code into an existing program, ditto for your config and it compiles fine for a 16F631 for me PBP ver 2.6. I thought the omission of eecon1 settings might be your problem, but alas it compiles without error without it. What version of PBP are you using? Maybe the latest ver. has added something because I see no mention of EEPGD in my lib until line 6069 and there is mention of EECON1 in there, try setting the EECON1 register and see it that works. The 16F631 series resets with eeprom write disabled to prevent accidental writes on power up.

Luckyborg
- 13th August 2009, 22:02
I'm using compiler version 2.47, maybe that is the problem. I see melabs updated some RAM issues with this chip. I don't know enough to know if the compiler will pass the code off to the PM assembler correctly but not to MPASM. My code has seemed to work correctly for quite a while, but perhaps I'm not pushing the right buttons to make it break.

Thanks for checking for me Joe.:)

Anyone else out there with 2.47 who can try to compile the above for me to see if they get the same results or not?

David

Bruce
- 13th August 2009, 22:28
The RAM issue is an easy fix. Open your 16F631.BAS file and change BANK0 $0020, $007F
to BANK0 $0040, $007F. RAM on this one starts at $40 not $20. Save & exit.

The EEPGD thing is due to the 16F631 not having this bit available, since it can't read/write
to its own program memory. But the library functions for READ and WRITE use it.

You can fix the READ/WRITE library routines:

Open your pbppic14.lib, and scroll down to the READ library routine.

Comment the bcf EECON1,EEPGD and add the clrf EECON1 just below it.


;bcf EECON1, EEPGD ; Read from data memory
clrf EECON1 ; Read from data memory


Scroll down a ways to the WRITE library routine, and do the same thing.

I don't have a 16F631 to test, so let me know if this fixes it for you.

mackrackit
- 13th August 2009, 22:41
I am still using PBP2.5 and I get the ram errors also.

The 16f631.bas currently has
BANK0 $0040, $007F

RAM END MUST BE DEFINED is the error.

EDIT>>>
I get the same errors with PM also... So it must not be a MPASM thing

Luckyborg
- 13th August 2009, 22:53
I had the RAM issue already fixed. I had forgotten Charles LEO helped with that back in 07 when I first started with this chip. I have since made the 2 changes to the read and write routines that Bruce gave and the errors went away. Now all that is left to do is to test it out. Thanks to everyone for your help

David

mackrackit
- 13th August 2009, 23:04
I had the RAM issue already fixed. I had forgotten Charles LEO helped with that back in 07 when I first started with this chip. I have since made the 2 changes to the read and write routines that Bruce gave and the errors went away. Now all that is left to do is to test it out. Thanks to everyone for your help

David

How were the ram errors fixed?

Luckyborg
- 13th August 2009, 23:10
I had modified the file manually at Charles instructions. I originally emailed MELabs and they told me what to fix for the RAM bank problem. Bruce's instructions got rid of the 2 errors I originally posted. I never got the same error that you posted. I never had any problems with PM.

mackrackit
- 13th August 2009, 23:15
That is interesting.
I do not have that chip so I guess I will not worry about it on this version.

Thanks.

Bruce
- 14th August 2009, 16:04
Dave,

I tried this with 2.50c and didn't get the error you show. Have you downloaded/installed
the 2.50c patch?

Acetronics2
- 14th August 2009, 16:09
Hi, Bruce

No error nor with PbP 2.50c / MCS / MPASM ...

The 2.50c release has .bas and .lib genuine corrected files

Alain

mackrackit
- 14th August 2009, 17:01
Looks like I need the patch. But darn, I have modified files. Time for the upgrade.

Thanks for the info..

Archangel
- 14th August 2009, 17:09
Looks like I need the patch. But darn, I have modified files. Time for the upgrade.

Thanks for the info..
Hi Dave,
The "Upgrade" will not only waack your modified files, you<b> WILL</b> have to modify all your programs where you used " LOOP" as a label, because they added a<b> DO LOOP</b> function. Thinking out loud . . . I wonder if I can stop that function by editing it out of the library . . .

Acetronics2
- 14th August 2009, 17:10
Hi, Dave

you lucky Americans ...

2.60 Upgrade in Europe = ... ~ 60 US $ ...

http://www.crownhill.co.uk/product.php?prod=2127

you said strange ???

Alain

Archangel
- 14th August 2009, 17:19
Hi, Dave

you lucky Americans ...

2.60 Upgrade in Europe = ... ~ 60 US $ ...

http://www.crownhill.co.uk/product.php?prod=2127

you said strange ???

Alain
Yes, and You lucky Europeans got PICKit2 much cheaper than we did :D But seriously, wait a couple of more weeks and $60 US will be worth what . . . about 12 Euros ?

mackrackit
- 14th August 2009, 17:21
Hi Dave,
The "Upgrade" will not only waack your modified files, you<b> WILL</b> have to modify all your programs where you used " LOOP" as a label, because they added a<b> DO LOOP</b> function. Thinking out loud . . . I wonder if I can stop that function by editing it out of the library . . .
Looks like the new version is going to be a lot of fun.


Hi, Dave

you lucky Americans ...

2.60 Upgrade in Europe = ... ~ 60 US $ ...

http://www.crownhill.co.uk/product.php?prod=2127

you said strange ???

Alain
You gotta pay something to float the CDs and keep the manual dry going across the pond.

Strange?? I resemble that :eek: