asm NOP after TRIS change

Discuss about beta versions of mikroC compiler.
Post Reply
Author
Message
picdog
Posts: 390
Joined: 28 Feb 2006 09:32

asm NOP after TRIS change

#1 Post by picdog » 23 Dec 2007 18:20

Hello,
I just would to remember to implement in the next release, if possible, the addition of a NOP asm instruction after every TRIS change to the I/O ports, as requested/recommended on the Microchip datasheet.
I just sent an email to M.E. crew about this some month ago after 4.0.0.0 release, and I would only to submit a reminder.
I am not sure if it is correct from a logic point of view to do this at compiler level, but if not, I think that this NOP instruction could fit in the user manual somewhere, in order the developers could remember to add it to the code.
Thank you.
picdog
... a proud user of MikroElektronica EasyPic3, EasyPic4, BigPic4, MikroC for PIC, EasydsPIC2, dsPIC-Pro2, LV24-33 and MikroC for dsPIC :)

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

Re: asm NOP after TRIS change

#2 Post by zristic » 28 Dec 2007 08:27

Thanks for the tip, we will surely do something about it.

User avatar
milan
mikroElektronika team
Posts: 1013
Joined: 04 May 2006 16:36
Contact:

#3 Post by milan » 15 Apr 2008 10:34

Hi picdog,

Can you provide me with link to the documentation describing this
for all families ?

picdog
Posts: 390
Joined: 28 Feb 2006 09:32

#4 Post by picdog » 15 Apr 2008 11:16

Hello Milan,

I found the information on paragraph 10.4 of the Microchip documentation for dsPIC33 families (but I remember also on PIC24F/H). The reference is document DS70286A.

I am not at the office at this moment but I can copy/paste this reference for you.

dsPIC33FJXXXGPX06/X08/X10
Data Sheet

Chapter 10: I/O Ports.

Sub-Chapter 10.4

10.4 I/O Port Write/Read Timing
One instruction cycle is required between a port direction change or port write operation and a read operation of the same port. Typically, this instruction would be a NOP.

Hope this helps. At the moment I am adding the NOP instruction manually where required.

Best regards,

picdog
... a proud user of MikroElektronica EasyPic3, EasyPic4, BigPic4, MikroC for PIC, EasydsPIC2, dsPIC-Pro2, LV24-33 and MikroC for dsPIC :)

User avatar
milan
mikroElektronika team
Posts: 1013
Joined: 04 May 2006 16:36
Contact:

#5 Post by milan » 15 Apr 2008 12:40

Hi,

I searched in PIC16 and PIC18 families :D

As you explained I found this note in family datasheets for dsPIC33 and PIC24H:
10.4 I/O Port Write/Read Timing
One instruction cycle is required between a port
direction change or port write operation and a read
operation of the same port. Typically, this instruction
would be a NOP.

I also found it in PIC24FJ datasheets, in chapter 9.2.1

We can't add NOP automatically, user can modify TRIS registers in several
different ways, compiler is not aware of TRIS change in all cases.

We intend to gather information about required nop and put it on forum as a tip for users.

picdog
Posts: 390
Joined: 28 Feb 2006 09:32

#6 Post by picdog » 15 Apr 2008 12:57

Hello Milan,
I'm glad my post was useful for you.

I agree with you, this NOP is not possible to be managed at compiler level, in fact in my first post of this topic I wrote that "... I think that this NOP instruction could fit in the user manual somewhere, in order the developers could remember to add it to the code".

Great idea to add it as a tip on the forum.

Best regards,

picdog
... a proud user of MikroElektronica EasyPic3, EasyPic4, BigPic4, MikroC for PIC, EasydsPIC2, dsPIC-Pro2, LV24-33 and MikroC for dsPIC :)

User avatar
milan
mikroElektronika team
Posts: 1013
Joined: 04 May 2006 16:36
Contact:

#7 Post by milan » 17 Apr 2008 10:02

Hi picdog,

we published it here
http://www.mikroe.com/forum/viewtopic.php?t=14545

Thank you once again.

Post Reply

Return to “mikroC Beta testing”