Monday 29 July, 2013 Expand to read article below CCS, Inc. C Compiler Version 5 supports Microchip's PIC10F®, PIC12®, PIC16F® 8-bit peripherals. These peripherals include: Numerically Controlled Oscillator(NCO), Pulse-Width Modulation(PWM), Complementary Waveform Generator(CWG), Configurable Logic Cell(CLC), and Data Signal Modulator(DSM).
Part two of this series will cover the Configurable Logic Cell(CLC), and Data Signal Modulator(DSM) peripherals within C Compiler Version 5.
The Configurable Logic Cell (CLC) module is a new peripheral that is supported by the CCS C compiler. The CLC module allows creating several different types of logic functions which are not limited by software execution speed. The CLC module can be configured into eight different types of logic cells including AND-OR gate, OR-XOR gate, 4-input AND gate, S-R Latch, 1-Input D Flip-Flop with Set and Reset, 2-Input D Flip-Flop with Reset, J-K Flip-Flop with Reset and 1-Input Transparent Latch with Set and Reset.
The CCS C compiler makes it easy to setup and use the CLC module by providing several built-in functions including setup_clcx(), clcx_setup_input() and clcx_setup_gate(), x being the module number 1 to 4 depending on the PIC. The setup_clcx() function enables and sets the logic type of the CLCx module. The clcx_setup_input() function is used to select the four inputs to be used with the CLCx module. Finally, the clcx_setup_gate() function is used to select which inputs to use with the 4 gates and the basic logic of the gates. The following is a simple example program that sets up the CLC2 module to perform an AND operation on the two CLC2 input pins (RC3 and RC4) and outputs the result onto the CLC2 output pin (RC0):
#include <16F1507.h>
#fuses NOWDT
#use delay(internal=16MHz)
void main(){
setup_clc2(CLC_ENABLED | CLC_OUTPUT | CLC_MODE_AND); clc2_setup_input(1,CLC_INPUT_0); //assign CLC2IN0 as input 1 clc2_setup_input(4,CLC_INPUT_5); //assign CLC2IN1 as input 4 clc2_setup_gate(1,0x102); //assign input 1 to gate 1 clc2_setup_gate(2,0x180); //assign input 4 to gate 2 clc2_setup_gate(3,CLC_GATE_SET); //assign a high level to gate 3 clc2_setup_gate(4,CLC_GATE_SET); //assign a high level to gate 4
while(TRUE) { } }
Another new peripheral that is supported by the CCS C compiler is the Data Signal Modulator (DSM) module. The DSM module allows mixing a data steam, modulator signal, with a carrier signal to produce a modulated output. The modulator signal supplied to the DSM module can be generated internally from a peripheral, for example the UART peripheral, or supplied externally from the MDMIN pin. The carrier signal is comprised of two distinct and separate signals, a carrier high signal and a carrier low signal. Both of which can be generated internally from a peripheral, for example CCP1, or supplied externally from the MDCIN1 and MDCIN2 pins. Using this method allows the DSM module to generate Frequency-Shift Keying (FSK), Phase-Shift Keying (PSK) and On-Off Keying (OOK) modulation schemes.
The CCS C compiler makes it easy to setup and use the DSM module by providing a single function, setup_dsm(), to setup and enable the module. The setup_dsm() function requires three parameters to be passed to it, the first parameter enables and setup the basic setting of the module, the second parameter selects the modulator signal source and the third parameter selects the carrier signal sources and sets up some carrier specific settings. The following is a simple example that sets up up the DSM module to modulate the UART1 signal with a 100 kHz carrier when the UART transmit line is high and a 20 kHz carrier when the UART transmit line is low. The modulated signal is then output on the MDOUT pin, pin RC4 for the PIC16F1829 used in the example:
#include <16F1829.h>
#fuses NOWDT
#use delay(internal=16MHz)
#use rs232(xmit=PIN_B7,rcv=PIN_B5,baud=9600)
void main() {
char c;
setup_timer_2(T2_DIV_BY_1,39,1); //period 10us, frequency 100kHz setup_timer_4(T4_DIV_BY_4,49,1); //period 50us, frequency 20kHz
setup_ccp1(CCP_PWM | CCP_TIMER2); set_pwm1_duty((unsigned int16)80); //50% duty cycle
setup_ccp2(CCP_PWM | CCP_TIMER4); set_pwm2_duty((unsigned int16)100); //50% duty cycle
setup_dsm(DSM_ENABLED | DSM_OUTPUT_ENABLED, DSM_SOURCE_UART1, DSM_CARRIER_LOW_CCP2 | DSM_CARRIER_HIGH_CCP1);
while(TRUE) { if(kbhit()) { c = getc(); putc(c);
if(c == 'r') putc('n'); else if(c == 0x08) { putc(' '); putc(c); } } } }
We invite to learn more about CCS C Version 5 by pointing your browser to: http://www.ccsinfo.com/version5
Like us on Facebook and follow us on Twitter.
About CCS:
CCS is a leading worldwide supplier of embedded software development tools that enable companies to develop premium products based on Microchip PIC ® MCU and dsPIC ® DSC devices. Complete proven tool chains from CCS include a code optimizing C compiler, application specific hardware platforms and software development kits. CCS' products accelerate development of energy saving industrial automation, wireless and wired communication, automotive, medical device and consumer product applications. Established in 1992, CCS is a Microchip Premier 3rd Party Partner. For more information, please visit http://www.ccsinfo.com.
PIC ® MCU, MPLAB ® IDE, MPLAB ® ICD2, MPLAB ® ICD3 and dsPIC ® are registered trademarks of Microchip Technology Inc. in the U.S. and other countries. REAL ICE, ICSP and In-Circuit Serial Programming are trademarks of Microchip Technology Inc. in the U.S. and other countries. | Monday 15 July, 2013 Expand to read article below CCS, Inc. C Compiler Version 5 supports Microchip's PIC10F®, PIC12®, PIC16F® 8bit peripherals. These peripherals include: Numerically Controlled Oscillator(NCO), Pulse-Width Modulation(PWM), Complementary Waveform Generator(CWG), Configurable Logic Cell(CLC), and Data Signal Modulator(DSM). In a two-part series we will cover these PIC® peripherals within C Compiler Version 5.
The Numerically Controlled Oscillator (NCO) module is a new peripheral that is supported by CCS C compiler. The NCO module is a timer used to generate a fixed duty Pulse-Width Modulation(PWM) or a pulse at a specific frequency. The NCO uses the overflow from the addition of an incremental value to divide the input frequency. The advantage of this is that the resolution of division does not vary with the divider value, making the NCO useful for applications that require frequency accuracy and fine resolution at a fixed duty cycle.
CCS C compiler makes it easy to setup and use the NCO module by providing several built-in functions including setup_nco() and set_nco_inc_value(). The setup_nco() function is used to enable, setup and set the increment value of the NCO module, and the set_nco_inc_value() function can be used to adjust the increment value of the NCO module. Adjusting the increment value of the module changes the frequency outputted by the module. When operating in fixed duty mode the frequency of the NCO module can be calculated with the following equation:
Frequency = (NCO Clock Frequency * Increment Value)/(2^21)
When operating in pulse frequency mode the frequency of the NCO module can be calculated with the following equation:
Frequency = (NCO Clock Frequency * Increment Value)/(2^20)
The following is a simple example program which sets up the NCO module in fixed duty mode at an initial frequency of 1 kHz. Every 5 seconds the program increases the period by 1kHz to a maximum of 16kHz and then repeats:
#include <16F1507.h>
#fuses NOWDT
#use delay(internal=16MHz)
#define INC_1KHZ 131072
void main() {
unsigned int8 i=2;
setup_nco(NCO_ENABLED | NCO_FIXED_DUTY_MODE | NCO_OUTPUT, INC_1KHZ / 1000);
while(TRUE) { delay_ms(5000);
set_nco_inc_value(((unsigned int32)(i) * INC_1KHz) / 1000);
if(++i > 16) i = 1; } }
Another new peripheral that is supported by the CCS C compiler is the Complementary Waveform Generator (CWG) module. This peripheral can be used in conjunction with several other peripherals including the PWM and NCO modules to generate a complementary PWM with dead-band delay and auto-shutdown control. The CCS C compiler make it easy to setup and use the CWG module by providing the built-in function setup_cwg(). The setup_cwg() function is used to enable, set-up, and set the dead-band delay time of the CWG module. The period, frequency, and duty of the complementary PWM depends on the input signal to the CWG module. The previous example can be easily modified to enable the CWG sourced by the NCO module with a dead-band delay of 10 for both the rising and falling edges by adding the following to the program:
setup_cwg(CWG_ENABLED | CWG_OUTPUT_A | CWG_OUTPUT_B | CWG_INPUT_NCO1OUT, CWG_NO_AUTO_SHUTDOWN, 10, 10);
In part two of this series, next week, we will discuss the new Configurable Logic Cell (CLC) and Data Signal Modulator (DSM) peripherals which are also supported CCS C compiler.
We invite to learn more about CCS C Version 5 by pointing your browser to: http://www.ccsinfo.com/version5
Like us on Facebook and follow us on Twitter.
About CCS:
CCS is a leading worldwide supplier of embedded software development tools that enable companies to develop premium products based on Microchip PIC ® MCU and dsPIC ® DSC devices. Complete proven tool chains from CCS include a code optimizing C compiler, application specific hardware platforms and software development kits. CCS' products accelerate development of energy saving industrial automation, wireless and wired communication, automotive, medical device and consumer product applications. Established in 1992, CCS is a Microchip Premier 3rd Party Partner. For more information, please visit http://www.ccsinfo.com.
PIC ® MCU, MPLAB ® IDE, MPLAB ® ICD2, MPLAB ® ICD3 and dsPIC ® are registered trademarks of Microchip Technology Inc. in the U.S. and other countries. REAL ICE, ICSP and In-Circuit Serial Programming are trademarks of Microchip Technology Inc. in the U.S. and other countries | Tuesday 25 June, 2013 Expand to read article below CCS, Inc. Add a low cost USB solution to your next project using CCS C Version 5.007 and PIC16F1459 MCU! CCS C Version 5.007 now supports the PIC16F1459 MCU which is notable for two reasons - it's the first PIC16F with USB support, and now USB can be used with the internal oscillator through the PIC® MCU's active clock tuning(ACT). This eliminates the need for an external oscillator which further reduces your costs while adding USB.
ACT keeps the internal oscillator accurate by syncing with the USB bus signals. ACT can be used and configured by CCS C Compiler's #use delay() instruction. Here is an example of clocking a PIC16F with the internal 8MHz clock, while setting the ACT to tune from the USB and setting the PLL to run the instruction clock to 48MHz:
#use delay(int=8MHz, clock=48MHz, USB_FULL, act=USB)
For more examples of this or for more information on CCS C Compiler V5.007 download the demo at http://www.ccsinfo.com/demo or visit: http://www.ccsinfo.com/version5
Like us on Facebook and follow us on Twitter.
Yours sincerely,
CCS, Inc.
PIC ® MCU, MPLAB ® IDE, MPLAB ® ICD2, MPLAB ® ICD3 and dsPIC ® are registered trademarks of Microchip Technology Inc. in the U.S. and other countries. REAL ICE™, ICSP™ and In-Circuit Serial Programming™ are trademarks of Microchip Technology Inc. in the U.S. and other countries. | Monday 10 June, 2013 Expand to read article below We know having access to previous compiler versions is essential. We also know that version standardization for project requirements, testing or certifications is also essential. Have peace of mind that now you can accomplish both objectives! Multiple compiler versions can be installed and from the IDE you now have the ability to run any previous version.
We invite you to visit www.ccsinfo.com/version5 for more information. Call or email our sales team to learn more about our special promotional offers as well. Like us on Facebook and follow us on Twitter.
Yours sincerely,
CCS, Inc. | Monday 10 June, 2013 Expand to read article below CCS, Inc. CCSC Version 5 with all of its new features and enhancements has just been released! Version 5 is the first release to include a very aggressive code optimizer, optimizing for space instead of speed. The new optimizer is able to search the entire compiled program to find repeating blocks of code whereby reducing all those repeating blocks into one shared sub-routine. Optimizer is executed during the final phase of the compile which presents the ability to cross a unit boundary when performing the optimization.
#opt compress: This new optimization level can be achieved by adding this line of code into your project.
The average size reduction of program memory is approximately 15%. In some cases we have seen program memory reduced by 60%. Provided below are examples of compression levels:
Optimization Level Efficiency | Compiler Versions | | V4.141 | V5.006 | File / Processor | (Program Memory Bytes) | Reduction % | ex_modbus_master.c PIC16F1937 | 3926 | 3068 | 22.00% | ex_j1939.c PIC18F4580 | 7552 | 6166 | 18.00% | ex_st_webserver2.c PIC18F4550 + ENC28J60 | 60282 | 52664 | 12.00% |
This new optimization level is supported on Enhanced PIC16 and PIC18 microcontrollers.
In the continuing evolution of new Version 5 we have added improved standardization and developed to follow conventional C standards:
- The .h file for specific PIC® MCU are now prototyped. Now included are prototypes of the compiler's built-in functions and data-types. This is useful for programmers using tools that would have flagged the compiler's built-in functions and data-types with an error because they were not defined.
- A new command-line parameter: sourceline. This now has been added to inject a C source-line into the file being compiled. Usage example:ccsc.exe +FH myfile.c sourceline="#device PIC16F887"
- Standard C libraries iso646.h and stdbool.h have been added.
Version 5 also includes the following new capabilities: Multiple Compiler Versions, Project Notes, Identifier Explorer, Files Navigation Panel, File History, Show in Explorer, Save to Notes, Mouse-over Watch, Drag and drop "watch items", plus many more. For more information on all of the Version 5 enhancements and new features please visit: www.ccsinfo.com/version5.
Like us on Facebook and follow us on Twitter.
Yours sincerely,
CCS, Inc.
PIC ® MCU, MPLAB ® IDE, MPLAB ® ICD2, MPLAB ® ICD3 and dsPIC ® are registered trademarks of Microchip Technology Inc. in the U.S. and other countries. REAL ICE, ICSP and In-Circuit Serial Programming are trademarks of Microchip Technology Inc. in the U.S. and other countries. | Thursday 16 May, 2013 Expand to read article below CCS, Inc. We are excited to announce CCSC Version 5 is set for full release next week! We are in the final stages of our successful beta testing and, over the last few weeks of development, we have added even more features and enhancements to the compiler and IDE. We would like to provide you with one last sneak peek into some of the key features that you will want to try for yourself.
Multiple Compiler Versions Version 5 IDE now supports previous versions of compiler allowing you to choose amongst legacy versions to use. This feature provides for standardization on a specific version based on projects, testing or certifications.
Project Notes Now, with each project, you'll be able to create a "Project Notes" file. This file allows you to create notes pertaining to each project. Each of these files can be associated to a particular project via the menu or Files navigation pane.
Identifier Explorer The new "Identifier Explorer" in Version 5 IDE allows for a quick and easy way to view the relationship between program identifiers. For example; which variables and functions are declared in each file, or to see all functions that access a global variable. This screen shot shows for a single function all global variables accessed, as well as, local variables and functions called.
Files navigation panel The style and functionality of the "Files Navigation Panel" has been improved and simplified. For example; it is much easier to add units, for linking, or to add other C and H files in single compilation unit projects.
Project History Version 5 now automatically maintains a history of source code changes. The IDE can be configured to specify how often and how many old files to be saved (maintain old file on every save, once an hour, once a day, etc). The File Compare utility inside the IDE also keeps this history and allows you to compare a current file to an older file from history.
Show in Explorer The right-click 'Show in Explorer' is now available on the editor tabs. This allows you to open an explorer window at the destination of the file.
Version 5 is set to launch next week! We invite you to visit www.ccsinfo.com/version5 for more information. Also be sure to stay tuned for upgrade specials and promotional offers.
Follow us on Facebook and Twitter
Yours sincerely,
CCS, Inc. | Monday 13 May, 2013 Expand to read article below CCS, Inc. CCSC Version 5 beta testing is underway and we are receiving exemplary reviews from our testers. Due to successful testing we are set to launch Version 5 on the week of May 20th, 2013! CCS would like to thank the hundreds of loyal customers who have agreed to beta testing Version 5. This large response has helped make Version 5 a solid development tool. At this point we would like to provide you with a sneak peek into some of these improvements.
Save to notes The option to "Save to notes" has been added to the right-click menu of multiple debug windows which will append the selected data (such as break log or RAM data) to the end of the notes file associated to the project.
Mouse-over Watch Hovering over any structure or array variable while debugging will now allow you to expand or collapse a pop-up note in the "watch window".
Drag and drop "watch items". Have an important watch variable that is in the middle or at the bottom of your watch list? You can now drag and drop watch items within the watch window to reorder them by your preference.
Be on the watch, later this week, for part two of the sneak peek! Version 5 is set to launch on the week of May 20th, 2013!
Just a reminder: May 16th is the last day to enroll for beta testing. To participate in beta testing and for more information on Version 5 we invite you to visit www.ccsinfo.com/version5. Also be sure to stay tuned for upgrade specials and promotional offers.
Follow us on Facebook and Twitter
Yours sincerely,
CCS, Inc. | Monday 25 March, 2013 Expand to read article below CCS has been hard at work improving our IDE Compiler. We can barely hold back our excitement to show our users the enhancements we have made to our IDE compiler to improve their projects. Many aspects of the IDE have been polished to give the IDE a more sleek and modern look and to provide more powerful tools for our users.
The Superbar has been slightly re-arranged to emphasize more commonly used items. Our C editor has been updated with instant syntax checking, column editing, smart highlighting and searching with regular expressions. Debugger improvements make it easier to watch complicated variables like arrays and structs.
The convenient Statistic viewer graphically displays the percentage amount of program memory, data memory and stack space. The Functions section graphically shows which functions use the most program memory or data memory in a pie chart. This is very useful for quickly determining which functions the user might need to review if the user is looking for ways to optimize the program to use less memory.
The revamped Tree viewer shows the call tree graphically. Each function of the call tree is represented by a block. Now the user can drag-and-drop the placement of the blocks. It is also possible to hide branches of the call tree and only inspect the calls out of one function.
The Editor now has a live syntax checker. Any code errors that would prevent the project from compiling will be displayed with a red-underline under the offending syntax. This check is done live while you are typing. To view the syntax error, simply hover the mouse over the underling.
Use our Copy project tool to copy all relevant files in your project to a new directory or ZIP file.
The sharpened Find and Search tool can now use regular expressions. Regular expressions allow the user to enter complex parameters into the search field for matching specific combinations of characters, digits or phrases. In the example screenshot, foob([0-9]|a+)r is entered which would find 'foob0r', 'foob1r', 'foobar', 'foobaar', etc.
The Editor has an improved 'Find all References' and 'Find Delcaration' tool. These unique new tools can be selected by right clicking on an identifier in the editor. 'Find All References' finds all the references of this identifier, while intelligently skipping over any commented references or similar identifiers that don't match because of overloading. 'Find Declaration' will find the location where the identifier was declared.
The advanced Bookmark tool is now project specific and spans all files in the project. The menu will also show you the locations where bookmarks were set.
Our Compile menu now has a new 'Build and Run' tool that will compile the program and program it to the microcontroller with one simple mouse click.
The Editor tool also has a column editing feature. This is useful if there are several lines that start or contain the same block of text but need to be replaced or edited. To use this feature, press the CTRL key on the keyboard while using the left mouse button on the mouse to select a block of text. Pressing DEL will delete that block of text, or typing will replace block of text with new text.
Find out for yourself how the new IDE enhancements can strengthen your productivity and get you ahead of the curve on your product development.
Take a look at the Version 5 page for additional features that will be in Version 5.
Keep your eyes peeled for V5 upgrade specials and deals.
Visit ccsinfo.com/enhance to purchase our feature rich IDE Compiler, Maintenance or Upgrade.
Follow us on Facebook and Twitter | Friday 02 November, 2012 Expand to read article below Why should you try the C++ Stream I/O operator support in the CCS Compiler? As you know, in standard C, basic I/O are handled by functions like getc(), putc() and printf() and the formatting of data is handled by functions like atoi(), atof(), strotul() and sprintf(). For example, reading a floating point number from the user over RS232 would require a combination of gets() followed by atof(). While CCS includes an input.c library that accomplishes many of these tasks, the input.c library uses a fixed RS232 stream and does not work with Keypad/LCD or USB without modification. Introducting in Version 5 of the CCS C Compiler, there is added support for the C++ stream operator. C++ streams provided a unified interface for I/O and data formatting.
The two new opreators added are the extraction operator and the insertion operator:
Operator Symbol | Operator Name |
>> | Extraction |
<< | Insertion |
When used, these operators show the direction of data. For example:
Example | Comment |
x>>y | Data read/parsed from x and saved/sent to y |
x<<y | Data read/parsed from y and saved/sent to x |
The beauty of these operators is that the x and y in the above examples can be any combination of function, RS232 serial stream, variable, string and more.
One of the key features of this new feature in the CCS C Compiler is the way it automatically handles the conversion based upon the data types of the variables passed. These conversions are done automatically, no other helper functions like atof() need to be called. For example, if a variable is of float type the compiler will properly convert it from string to float on an input or convert float to string on an output.
Read all the additional details on output and see examples of C++ Streaming by clicking through to: Version 5
A few examples: cout << fvar << endl; | // Display a floating point variable |
cin >> fvar; | // Read in a float |
lcd_putc << "count=" << count; | // send to LCD |
string1 >> fvar; | // string to float conversion |
Additional configurations and control options will also be available in Version 5. Feel free to contact us with any comments or questions about the serial library upgrades.....
Want to be a beta tester* for Version 5.... or make suggestions on what you would like to see in Version 5....click thru to the above link!
*All customers with active maintenance are eligible to apply for V.5 betas.
All customers with active maintenance when V.5 is released will receive V.5 at no additional cost.
Resources
To learn more about CCS's C Compiler, visit: Our Compiler Page
To see more helpful hints and tips, visit: Our FAQ Page or Our Customer Forum
Follow us on Facebook and Twitter | Wednesday 24 October, 2012 Expand to read article below CCS has added new #use capture() and #use pwm() libraries that makes it easier to use the PIC® MCU capture/compare/PWM, input capture and output capture peripherals. There are sometimes challenges in using these peripherals when designing the PWM to operate at a desired frequency and resolution, or configuring the capture peripheral to measure events at a known time duration. Another challenge is that the configuration is generally only valid for certain PIC families and one oscillator speed; changing the PIC® or the oscillator would mean reviewing and updating the way those peripherals are configured.
CCS’s new #use capture() and #use pwm() libraries solve these problems by making it easy to use these peripherals and making the code portable to different PIC® MCUs and oscillator speeds.
- #use capture() is when the input capture peripheral samples and holds a timer value when the peripheral’s input pin reaches the desired level. This peripheral is useful for measuring the time duration between two events.
- #use pwm() is for Pulse-width modulation (PWM), the method of pulsing a digital signal on/off to represent an analog signal. A PWM's two properties are its frequency and duty cycle. A duty cycle is the ratio the digital signal is on versus off.
See examples of these libraries with further details by clicking through to: Version 5
Additional configurations and control options will also be available in Version 5. Feel free to contact us with any comments or questions about the serial library upgrades.....
Want to be a beta tester* for Version 5.... or make suggestions on what you would like to see in Version 5....click thru to the above link!
*All customers with active maintenance are eligible to apply for V.5 betas.
All customers with active maintenance when V.5 is released will receive V.5 at no additional cost.
Resources
To learn more about CCS's C Compiler, visit: Our Compiler Page
To see more helpful hints and tips, visit: Our FAQ Page or Our Customer Forum
Follow us on Facebook and Twitter |
|