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

16f1503 compiler bug ? NAH its new syntax is all [solved]

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

16f1503 compiler bug ? NAH its new syntax is all [solved]
PostPosted: Mon Oct 15, 2012 6:29 pm     Reply with quote

v4.135
All i want it to be is a glorified F616 or F684 - basic analog and digital i/o with a PWM generator - to reduce costs on the an F616 part in small scale mass production. Just for $$ and cents but feeling stupid right now:

Code:

#include <16F1503.h>
#device ADC=10
#Fuses  INTRC_IO,WDT,PUT,NOMCLR,NOPROTECT,NOBROWNOUT
#fuses  NOCLKOUT,NOWRT,NOSTVREN,NOLPBOR,NODEBUG,NOLVP
#include <stdlib.h>
#use fast_io(A) // my anaal code retentiveness
#use fast_io(C) // ditto
#use delay( clock=8000000, INTERNAL )
//******
main(){
//******
      unsigned int8 i=0;
     
     setup_comparator(NC_NC_NC_NC);
     SETUP_SPI(SPI_DISABLED);
     //BAD
     SETUP_CWG(CWG_DISABLED,0);  // ** ERR= expecting a comma
     SETUP_PWM1(PWM_ENABLED);
     SETUP_DAC(DAC_OFF);
     setup_vref(VREF_OFF);
     // also BAD 
     SETUP_NCO(NCO_DISABLED); // **  ERR= expect comma
     SETUP_CLC1(CLC_DISABLED);
     SETUP_CLC2(CLC_DISABLED);
     // pwm1 will be used in compatibility mode
     SETUP_PWM2(PWM_DISABLED);
     SETUP_PWM3(PWM_DISABLED);
     SETUP_PWM4(PWM_DISABLED);

     output_a (0); output_c (0);
     set_tris_a (0b11101100); //  A4 is output for FLOAT cmd
     set_tris_c (0);

  while (1) {     delay_ms(100);   output-toggle( PIN_A0); } // while one
} // main end


But won't compile for me
and when i omit the 'bad' lines - still
have no pwm control , compared to pgm that works on f616 and f684 parts.
???? ............. Question


Last edited by asmboy on Tue Oct 16, 2012 11:41 am; edited 1 time in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19520

View user's profile Send private message

PostPosted: Tue Oct 16, 2012 1:19 am     Reply with quote

Several things. First the ',' at the end of the first fuses line, causes problems later with the compilation. Then, the output-toggle, should be output_toggle.
Main problem is that the number of variables passed needs to match what the functions want:
Code:

     SETUP_CWG(CWG_DISABLED,0,0,0); //setup_cwg, requires 4 parameters
     SETUP_NCO(NCO_DISABLED,0); //needs two parameters

Other thing, you need to setup timer2, before the PWM will run.

Best Wishes
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Tue Oct 16, 2012 11:09 am     Reply with quote

Quote:

setup timer2,


I omitted MUCH other code, just to highlight
my ignorance of the proper arguments for the two "needs comma" functions.

I had been setting up timer2, no problem in the delivered, working
F616 version of the target program.

Timer2 and other settings - were omitted for clarity in my post.

My next step is to make it compile and then try the various functions.

Many thanks Ttelmah

comment to those who are about to use the 16f1503 PWM
for OUTPUT to a PIN ......

Code:

   setup_pwm1(PWM_ENABLED|PWM_OUTPUT);


unlike with previous parts in the 16F family -
the added argument "PWM_OUTPUT" MUST be present to
enable any output at all.
temtronic



Joined: 01 Jul 2010
Posts: 9229
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Oct 16, 2012 2:35 pm     Reply with quote

so....
once you figure in the new R&D $$$$ is the new version more cost effective or should you have stayed with what was 'tried and true'?

been down that road several times so I'm curious if you 'won'!

jay
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

r&D $$
PostPosted: Tue Oct 16, 2012 4:19 pm     Reply with quote

1- end user pays by the hour for the work.

2- the charges to make the change ( appx $1k ) are recovered by the savings on a 10k piece run - saving over $3k AND when gettign 10K of the F616 SOIC is not EZ - customer can use the F684 - even if the $$ savings is LOST - at least the run is not on hold that way.

3- customer requested diversity in PICS that could be used, so that when a prod run is done - there will be no lost time waiting for the pics. in fact all critical semiconductors in the project are multiple sourced.

that said the F1503 was a REAL PITA to work with - especially the A/D functions - which do NOT translate correctly under CCS 4.135 yet
compared to the F616 ref design.

i am NOT thrilled with the wacked out architecture of the 1503 at all -
temtronic



Joined: 01 Jul 2010
Posts: 9229
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Oct 16, 2012 6:34 pm     Reply with quote

yup, having a second source is always a great plan and if a third source is available all the better.
Reminds me of the 68hc11 conundrum 30 years ago...moto wouldn't sell me less than 10k units...but a smart sales guy sold me toshiba parts! Said they were made in the same factory (offshore of course). That's when I changed to PICs and have never found them to not do what I need them to do.
I've never understood why manufacturers 'change' stuff from time to time...yeesh if it work fine do NOT 'upgrade' and please be compatible with previous product, especially pinouts.....memory maps....sigh.
jay
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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