A problem with PORTF

Discuss about beta versions of mikroC compiler.
Post Reply
Author
Message
CGEngineering
Posts: 144
Joined: 09 May 2007 23:31
Location: Florence - Italy
Contact:

A problem with PORTF

#1 Post by CGEngineering » 27 Jul 2007 12:13

Hi,

today i discovered a little problem with my mikroC 7.0 beta.
If i set PORTF (i use a pic18f8621) like this :

Code: Select all

TRISF = 0x00
Means that PORTF is all-outputs, and then i would like to access single pins using this :

Code: Select all

PORTF.F0 = 0;
PORTF.F1 = 1;
etc. But it doesn't work!

Using that, instead :

Code: Select all

PORTF = 0x02
it works perfectly. I think that there are some problems with bit-wise operations :)

Bye
CG

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

#2 Post by picdog » 27 Jul 2007 20:08

Hello!
just curious for your post, I tried quickly this snippet:

void main(void) {
TRISF = 0x00;
PORTF.F0=0;
PORTF.F1=1;
}

compiling it with 7.0beta on target 18F8722 (and then 18F8621).

With the internal simulator it works. I tried also other combinations of bits. I have many firmwares that are on the field compiled with 6.2.1.0 and they do extensive use of .Fx, so I was very interested in checking this, but I am not able to reproduce your error, so if possible please post the exact your code.
Thank you and have a good weekend!
picdog
... a proud user of MikroElektronica EasyPic3, EasyPic4, BigPic4, MikroC for PIC, EasydsPIC2, dsPIC-Pro2, LV24-33 and MikroC for dsPIC :)

CGEngineering
Posts: 144
Joined: 09 May 2007 23:31
Location: Florence - Italy
Contact:

#3 Post by CGEngineering » 31 Jul 2007 12:16

picdog wrote:Hello!
just curious for your post, I tried quickly this snippet:

void main(void) {
TRISF = 0x00;
PORTF.F0=0;
PORTF.F1=1;
}

-cut-

am not able to reproduce your error, so if possible please post the exact your code.
Hi!
thanks for your reply. I modified the code before reading this post, so i can't copy/paste what i wrote on friday.
I don't use simulators, i write into a real uC and switch the power on :-D.
I noted that this bit-wise problem is only on PORTF .
I haven't tried on other uCs because i'm working with this at the moment (PIC18F8621 or PIC18F8622)

Bye
CG

bruno
Posts: 767
Joined: 10 Sep 2005 02:10
Location: Lyon, France
Contact:

#4 Post by bruno » 31 Jul 2007 13:59

Hello,

did you disable ADC and comparator modules ? they all are multiplexed with PORTF pins.
ADCON1 register should be set to 0x0f to have full PORTF as digital I/O.
Bruno
Bored with 7-segment ? Try the [url=http://www.micro-examples.com/public/microex-navig/doc/079-touchclock.html]TouchClock[/url]

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

#5 Post by janni » 31 Jul 2007 15:42

CGEngineering wrote:I don't use simulators, i write into a real uC and switch the power on :-D.
I noted that this bit-wise problem is only on PORTF .
It could have been RMW (read-modify-write) problem rather than compiler issue. Use LATF instead of PORTF.

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

#6 Post by picdog » 31 Jul 2007 19:30

Hello CGEngineering!
I also use real uC, when possible :-) but now are at holidays ;)

But Iuse also Proteus VSM simulator. I hold the license for PIC24, unfortunately not for PIC18 :( It is a complete simulator, with also interrupts, watchdog, and issues related to ADCON & other SFRs. So many times it is very useful to replicate the things.

Hope I can be helpful to you in the future. I appreciate very much your posts!

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

Post Reply

Return to “mikroC Beta testing”