Jump to content
Paolino

Instruction Set Extension And Indexed Addressing Mode

Recommended Posts

Dear all,

I was going mad for the following experience which I share with you, maybe someone can find out the reason.

 

Simple project: I needed to drive a 2x16 LCD and included lcd_driver.h. The PIC is a PIC18F2520, so I took care with PORTB analog settings, since PORTB is used to drive LCD.

The PIC correctly runs with its internal RC-oscillator, at 8MHz.

The problem comes out with a CONFIGURATION BIT: I decided to use the extended instruction set of that PIC, so I wrote:

 

#pragma DATA	_CONFIG4L, _STVREN_OFF_4L & _LVP_OFF_4L & _XINST_ON_4L & _DEBUG_OFF_4L

 

but the LCD did not show anything! I explored all the possible roads: hardware fail, wrong connections, oscillator configuration, etc. Then I decided to try to switch-off the extended set instruction:

 

#pragma DATA	_CONFIG4L, _STVREN_OFF_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L

 

and the LCD works!

 

I can not figure out why, maybe Pavel and/or Dave can give us a good explanation of that trouble.

 

Thank you.

 

Paolo.

Share this post


Link to post
Share on other sites

The LCD library is probably compiled without the extended instruction set.

 

It is not usually recommended to mix standard and extended instrustion as standard instructions can be interpreted differently in extended mode.

Read the extended instruction section of the pic manual for a fuller explanation.

 

If you have the LCD library source code you can always try recompiling though I am not sure if BoostC supports extended mode.

 

Cheers

 

Reynard

Share this post


Link to post
Share on other sites

The BoostC compiler does not currently support PIC18 Extended instructions.

 

Regards

Dave

Share this post


Link to post
Share on other sites
The BoostC compiler does not currently support PIC18 Extended instructions.

 

Regards

Dave

 

Thank you, Dave. I promise I won't use XINT_ON till you have not implemented them :( I do not want anymore troubles with extended instruction set :huh:

 

Cheers.

 

Paolo.

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...