CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

set_tris_a problem
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 15, 2004 1:06 pm     Reply with quote

Quote:
I am not certain how to edit the device if you are using the
command line version

I don't think we can do it. You don't get the device editor with
the command line version. CCS needs to be contacted and told
about this so they can fix it in the next version. Besides the 16F88,
the same problem occurs with the 16F87, which is not surprising
because it's a similar chip.
Guest








PostPosted: Wed Dec 15, 2004 2:23 pm     Reply with quote

Did you see my comment about the accesses to reserved location 0x1B ?

That sounds like a cut and paste error also. 0x1b is the location of a CCP2 control register in other PICs.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 15, 2004 2:39 pm     Reply with quote

They select Bank 1 before they access the register, so
it's really register 0x9B, which is a valid register address (ANSEL).
Code:

8 0007 1683 BSF 0x3, 0x5     // Select Bank 1

9 0008 121F BCF 0x1f, 0x4    // Clear the Vcfg bits of ADCON1
10 0009 129F BCF 0x1f, 0x5

11 000A 081B MOVF 0x1b, W    // Read ANSEL into W
12 000B 3980 ANDLW 0x80      // Clear all the ANSx bits
13 000C 380F IORLW 0xf         // Set the lower 4 channels as Analog
14 000D 009B MOVWF 0x1b     // Update the ANSEL register
ellrod



Joined: 14 Dec 2004
Posts: 6
Location: Boston, Ma

View user's profile Send private message

PostPosted: Thu Dec 16, 2004 8:31 am     Reply with quote

Ah yes, stupid me. Thanks for your help !
_________________
Arnie Jones
Contract Embedded Systems Developer
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Dec 17, 2004 1:31 pm     Reply with quote

Are you going to report this bug to CCS ?
Since you have the Device Editor, you were able to fix it.
So I want to check if you're going to report it.
If you don't want to, I'll do it.
GDetienne



Joined: 20 Sep 2003
Posts: 47
Location: Brussel - Belgium

View user's profile Send private message

PostPosted: Sat Dec 18, 2004 3:18 am     Reply with quote

I wish add info about this problem about 16F88 and last version of PCWH.

I write a little program to write two line on LCD 2x16 ( A0...A3 = data , A5 = MCLR, A6 = RS and A7 = CS). Nothing on port B.

I declare :

Code:
   
#use fast_io ( A )
setup_adc_ports(NO_ANALOGS);
set_tris_a ( 0x20 );
[

It's ok I read text on LCD.
Now I add only the two following lines :

Code:

#use fast_io ( B )
set_tris_b ( 0x85 );
[

After compilation I read bad caracters on my LCD and the program stop.
Here the compiled part :

Code:
 
CCS PCM C Compiler, Version 3.214, 26317               17-d�c.-04 22:25


....................    #use fast_io ( A )
....................    #use fast_io ( B )


....................    setup_adc_ports(NO_ANALOGS);
*
016B:  BSF    03.5
016C:  BCF    1F.4
016D:  BCF    1F.5
016E:  MOVF   1B,W
016F:  ANDLW  80
0170:  MOVWF  1B
....................    set_tris_a ( 0x20 );
0171:  MOVLW  20
0172:  TRIS   5
....................    set_tris_b ( 0x85 );
0173:  MOVLW  85
0174:  TRIS   6
....................


Where is my fault ? Why they use the instruction TRIS for 16F88 (16F876 work see my other Topic about printf) ?

Thanks and regard.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Dec 18, 2004 11:34 pm     Reply with quote

I tested the most commonly used PICs for the PCM compiler vs. 3.214
to see if they used the obsolete TRIS instruction. A lot of them do.
Here is the simple test program that I used:
Code:
#include <16F628.h>
void main()
{
set_tris_a(0x55);
}

I didn't test every PIC that's supported by the PCM compiler,
because for a lot of the older 16c series, the TRIS instruction is legal.
But I think for most of the 16F series, the data sheet says not to use it.
As we've seen in this thread, if you use it for some PIC processors,
it doesn't work correctly. I think it's just some chaff left in the silicon
by Microchip. It's not reliable. They really should have turned it into
a NOP or something, rather than leaving a "half-assed" partially-working
instruction in there.

I think the reason that CCS has it in so PICs, is because they use
the Device Editor screen for one PIC as a template, and then it gets
propagated into a lot of other PICs as they add new devices.

I actually don't see this bug, because I never use the "fast_io" directive.
But for those people who do, it probably contributes to the idea of a
flakey program or PIC, or compiler.

I'm going to email CCS this list and suggest that they fix all the Device
Editor files for the next release.

Code:

12C671
12C672
12CE673
12CE674
12F629      Uses TRIS instruction
12F635      Uses MOVLW
12F675      Uses TRIS instruction
12F675F     Uses TRIS instruction
12F675H     Uses TRIS instruction
12F675K     Uses TRIS instruction
12F683      Uses TRIS instruction

16C61
16C62
16C62A
16C62B
16C63
16C63A
16C64
16C64A
16C65
16C65A
16C65B
16C66
16C67
16C70
16C71
16C72
16C72A
16C73
16CR62
16CR63
16CR64
16CR65
16CR72
16F72
16F73
16C432
16C433
16C554
16C558
16C620
16C620A
16C621
16C621A
16C622
16C622A
16C642
16C662
16C710
16C711
16C712
16C715
16C716
16C717
16C73A
16C73B
16C74
16C745      Uses TRIS instruction
16C74A
16C74B
16C76
16C77
16C83
16C84
16C84A
16CE623
16CE624
16CE625
16CR83
16CR84
16F627      Uses TRIS instruction
16F627A     Uses TRIS instruction
16F628      Uses TRIS instruction
16F628A     Uses TRIS instruction
16F630      Uses MOVWF
16F636      Uses MOVWF
16F648A     Uses TRIS instruction
16F676      Uses MOVWF
16F684      Uses MOVWF
16F688      Uses MOVWF
16F716      Uses TRIS instruction
16F737      Uses MOVWF
16F74       Uses TRIS instruction
16F76       Uses TRIS instruction
16F77       Uses TRIS instruction
16F83       Uses TRIS instruction
16F84       Uses TRIS instruction
16F84A      Uses TRIS instruction
16F87       Uses TRIS instruction
16F88       Uses TRIS instruction
16LC74B     Uses TRIS instruction
16LF84A     Uses TRIS instruction
16C641      Uses TRIS instruction
16C661      Uses TRIS instruction
16C765      Uses TRIS instruction
16C770      Uses TRIS instruction
16C771      Uses TRIS instruction
16C773      Uses MOVWF
16C774      Uses MOVWF
16C781      Uses TRIS instruction
16C782      Uses TRIS instruction
16C923      Uses TRIS instruction
16C924      Uses TRIS instruction
16C925      Uses TRIS instruction
16C926      Uses TRIS instruction
16F747      Uses MOVWF
16F767      Uses MOVWF
16F777      Uses MOVWF
16F818      Uses MOVWF
16F819      Uses MOVWF
16F870      Uses MOVWF
16F871      Uses MOVWF
16F872      Uses MOVWF
16F873      Uses MOVWF
16F873A     Uses MOVWF
16F874      Uses MOVWF
16F874A     Uses MOVWF
16F876      Uses MOVWF
16F876A     Uses MOVWF
16F877      Uses MOVWF
16F877A     Uses MOVWF
16F785      Uses TRIS instruction
16F913      Uses TRIS instruction
16F914      Uses TRIS instruction
16F916      Uses TRIS instruction
16F917      Uses TRIS instruction
GDetienne



Joined: 20 Sep 2003
Posts: 47
Location: Brussel - Belgium

View user's profile Send private message

PostPosted: Sun Dec 19, 2004 7:08 am     Reply with quote

Thanks for your research about the reason of this problem.

I send also a mail to CCS.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 22, 2004 3:08 pm     Reply with quote

I got an email back from CCS support. They can't duplicate the
problem with the 16F88 given in the first part of this thread.
Because of that, they implied to me that they are not going
to change the TRIS instructions to MOVWF in the list of PICs
that I previously posted.
GDetienne



Joined: 20 Sep 2003
Posts: 47
Location: Brussel - Belgium

View user's profile Send private message

PostPosted: Wed Dec 22, 2004 4:26 pm     Reply with quote

This is the answer received today from CCS about this problem :

Code:

The TRIS does work fine on the 16F88 part.  I just tested it.  If the instruction bothers you then use the TOOLS > DEVICE EDITOR to select your part then expand OTHER FEATURES and set TRIS to false.
 
Send me your program that does not work and I can review it.


I do it tomorrow.

Thanks.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group