CCS News RSS

Tech Note: C++ Stream Operator Support

Tuesday 27 May, 2014

C++ streams provide a unified interface for IO and data formatting! The two operators within the C-Aware IDE V.5 are the extraction operator and the insertion operator. The '>>' operator is used for formatted extractions while and the '<<' operator is used for formatted insertions. A flexible and simple way to design the input/output routines of any application is through the use of IO streams operators. Through this example the operators show the direction of data:



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. Here are some quick and easy of examples of how you can use the C++ Stream Operators in your code:

  • Use this example for a simple RS-232 output of a number:
    cout << "Value is " << value << endl;
  • For output to an LCD the following example code is just as simple:
    lcd_putc << "Value is " << value << endl;
  • Just as easily convert numbers to a string:
    string1 << value;
  • Or strings to a number:
    string1 >> value;
  • Parsing an input line of space delimited numbers is as easy as:
    cin >> value1 >> value2 >> value3;
    Of course integers, floats, int1's and more can be used just as easily as values.
  • Many manipulators are available. For example to output the value in hex use this example:
    cout << "Value is " << hex << value << endl;


For more information on the C++ IO Stream Operator Support functionality please visit:
http://www.ccsinfo.com/iostream

Like us on Facebook. 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.

CCS C Supports the PIC12(L)F1612 and PIC16(L)F1613 Devices

Monday 28 April, 2014

The Microchip PIC12(L)F1612 and PIC16(L)F1613 PIC® MCUs have recently been added to the PCM compiler. Some of the unique peripherals that these devices have are an 8-bit Digital-to-Analog Converter (DAC) Module, a Zero-Cross Detection (ZCD) Module, a Cyclic Redundancy Check (CRC) Module, a 24-bit Signal Measurement Timer (SMT) and a Windowed Watchdog Timer (WDT). All are fully supported by the compiler's built in functions.

These devices are the first Midrange 8-bit class chips to have a CRC hardware module. The CRC module has a configurable 17 bit polynomial, standard or reverse bit order and software loadable data registers. The CCS C compiler provides the following functions for setting up and using the CRC module: setup_crc(), crc_init() and crc_calc(). The setup_crc() function is used to set the CRC polynomial, for example setup_crc(16, 15, 2, 0); will set the CRC polynomial of x16 + x15 + x2 + 1. The crc_init() function is use to set the starting value, and the crc_calc() function is used to calculate the CRC.

The following is an example of how to setup the CRC module with the CRC-16 polynomial x16 + x15 + x2 + 1, to initialize the CRC to zero and then to calculate the CRC for the data bytes 0x55, 0x66, 0x77 and 0x88:

unsigned int8 CRCData[4] = {0x55,0x66,0x77,0x88};
unsigned int16 CRCResult;

setup_crc(16, 15, 2, 0);
crc_init(0);

CRCResult = crc_calc(CRCData, 4, 8);


The SMT peripheral is a new peripheral that can be used as a 24-bit timer, or it can be setup to measure a variety of digital signal parameters such as pulse width, frequency and duty cycle, and the time difference between edges on two signals. The CCS C compiler provides the following functions for setting up and using the SMT module: setup_smt1(), setup_smt2(), smt1_start(), smt2_start(), smt1_read(), smt2_read(), smt1_write(), smt2_write(), smt1_status() and smt2_status(). The setup_smt1() and setup_smt2() functions are used to setup the SMT1 and SMT2 peripherals. The smt1_start(), smt2_start, smt1_stop() and smt2_stop() functions are used to start and stop the SMT1 and SMT2 peripherals. The smt1_read() and smt2_read() functions are used to read the SMT1 and SMT2 captured period and captured pulse width registers. The smt1_write() and smt2_write() functions are used to set the SMT1 and SMT2 timer and period registers. The smt1_status() and smt2_status() functions returns the status of the SMT1 and SMT2 peripherals.

The following is an example of how to setup the SMT1 peripheral to continuously read the period and duty cycle of input signal on the SMTSIG1 pin, and how to read the captured period and duty cycle from the peripheral:

unsigned int32 Period;
unsigned int32 DutyCycle;

setup_smt1(SMT_ENABLED | SMT_MODE_PERIOD_DUTY_CYCLE_ACQ |
SMT_REPEAT_DATA_ACQ_MODE | SMT_CLK_FOSC);
smt1_start();

Period = smt1_read(SMT_CAPTURED_PERIOD_REG);
DutyCycle = smt1_read(SMT_CAPTURED_PULSE_WIDTH_REG);


We invite you to visit the CCS Devices Supported page for more information on the devices that the CCS C Compilers support. Feel free to visit the Compiler product pages for more information as well.

Like us on Facebook. 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.

Track Project Time with the New Project Watch!

Wednesday 09 April, 2014

The new Project Watch utility within the CCS C-Aware IDE makes keeping track of project development easier than ever! The Project Watch tool provides the user detailed log information on the current working project. Time-management can be viewed through either a 'Daily Activity' log, including total editing and debugging time, or 'Specific Activity' log containing time the specific activity occurred.

View logs, contained in the Project Watch tool by selecting between two view modes: 'Selected Date(s)' or 'All Entries'. The 'Selected Date(s)' view shows the log information for the currently selected day(s) on the calendar. The 'All Entries' view shows the entire log that has been collected for the project, including a summary of the log and detailed information separated by each day.

Additionally, comments can be added or modified to a Project Watch log from a pop-up menu by right-clicking on any date that contains log information. Any changes to the comments will be saved to the project log and displayed in the log information window. The Project Watch feature is available under the 'View' ribbon in the IDE.






Like us on Facebook. 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.

Fast and Easy Programming with Prime8 and LOAD-n-GO!

Wednesday 09 April, 2014

The Prime8 firmware v.1.14 and LOAD-n-GO firmware v.1.22 software updates introduce many new features! Enhancements to minimum and maximum programming limits and slot file naming makes programming with the Prime8 and LOAD-n-GO easier and faster than ever.

Both the Prime8 and LOAD-n-GO Programmers offer the ability to store programs to a specific slot, for rapid deployment using the on-board Flash. The firmware update to these programmers now sets the default maximum writes per slot to 'unlimited'. This feature provides the user complete control over the programmer with the flexibility of any number of writes to the target. The maximum writes per slot can be modified using the CCSLOAD Programer Software v.5.00.

The Prime8 now allows users the ability to save a file name to the internal memory slot and enable or disable file names displayed on the LCD. This feature enables the user to easily find the slot, and readily program versus having to remember which slot you programmed a file to.

To update the firmware on the Prime8 or LOAD-n-GO simply connect either programmer unit to your PC and open the CCSLOAD Software. From the 'Diagnostics' tab select the 'Update Firmware' button. From the drop-down menu select the latest firmware version and select the 'Load Firmware' button. You will now have the latest firmware version installed to access these neat, new features.



Like us on Facebook. 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.

Fast and Easy Programming with CCSLOAD!

Wednesday 12 March, 2014

CCS is now undergoing beta testing for the latest version of the CCSLoad Programmer Control Software, available on our downloads page! New features include: Auto Programming and Improved Logging!



In addition to a new look, we have added an improved automatic programming mode which makes it fast and easy to program multiple devices sequentially. In this mode, the target device is automatically detected and programmed with the selected file. After programming, you are instructed to disconnect the target and connect another, repeating this cycle until you disable the automatic programming mode.

We have also improved the logging and viewing of specific log information. You can now view log information from a panel in the software. This is especially useful when writing target chips with serial numbers, as the serial number data is displayed for each target that is programmed as it is programmed.



We are also looking for input from you! This is a beta test, so if you have any feature requests for this new version or experience any bugs, let us know! Please email marketing@ccsinfo.com

Like us on Facebook. 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.

Tech Note: New Microchip 12-bit Parts Have Interrupt Capability

Wednesday 12 March, 2014

Microchip Technology's newest 12-bit PIC® MCUs include the long awaited feature of interrupts in the baseline family. The PIC16F527 and PIC16F570 have Timer 0, ADC, Comparator and Interrupt on interrupts and are fully supported in the latest version of the CCS Compiler. Interrupts can be enabled, disabled, and interrupt service routines are created the same way in the PCB compiler as they are in PCM, PCH and PCD compilers.

The defines INT_TIMER0, INT_AD, INT_COMP and INT_RA, for PIC16F527, or INT_RB, for PIC16F570, are added to the device's header file. Using one of the previous defines with the '#' sign in front of it is used to create the interrupt service routine for that interrupt. Also passing one of the defines to the enable_interrupts() or disable_interrupts() functions is used to enable or disable that interrupt. Finally, GLOBAL is used in the enable_interrupts() or disable_interrupts() functions to enable or disable the device's global interrupt. The following is an example of using the Timer 0 interrupt on a PIC16F527 to toggle PIN_A5 at a rate of approximately once every 250 ms:



Like us on Facebook. 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.

Tech Note: Instantly View Program Identifier Relationships with Identifier Explorer

Wednesday 12 March, 2014

The Identifier Explorer feature in the C-Aware 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 [fat_init()] all global variables accessed, as well as, local variables and functions called. To access the Identifier Explorer tool simply click on the "View" tab and select "ID Explorer".

In the "Defines" tab you can test the macros defined in your code and newly defined macros through the ID Explorer. An advantage of this feature is the ability to test your macros without needing to completely recompile or reprogram.



Through the "Files" tab you can easily view "Global" variable and functions in each file of the project. This is handy for locating where all your functions and variables are in the code.



Like us on Facebook. 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.

Windows 8.1 Support Tips and the New CCS App

Monday 03 March, 2014

CCS, Inc. is pleased to announce its Windows 8.1 compatibility. Below are some tips to consider while using Windows 7, 8 & 8.1:

  • No need to troubleshoot compatibility
  • Even with User Account Control disabled, you will sometimes need to run the IDE as administrator.
    • For example if you change the installation files.
    • Note that even though you are the administrator it does not mean the program will run as administrator. You will have to manually select "Run as administrator" yourself.
    • To run as administrator simply right-click the Compiler icon on the desktop and select: "Run as administrator"
    • Running the installer may also require running as admin.
  • It is highly recommended to use the Windows 8.1 default directory structure
    • Projects must be saved in a location the compiler has permission to access. Under "My Documents" is best. To locate the project directory that is setup during installation use:
      • Windows 7: Start > All Programs > PIC-C > Project Dir
      • Windows 8: Start Screen > Search: "Project Dir" > Select top result
    • Use "C:Program FilesPICC" on 32-bit systems, or "C:Program Files (x86)PICC" on 64-bit systems for install location
    • This will prevent possible problems during usage


CCS has published a New Windows 8 App available for download through the Windows Store. Downloading the app provides access everything from CCS in one place. Features of the new CCS App:

  1. Access to the CCS C Compiler: Easily launch the compiler from the app with a single click!
  2. Launch CCSLOAD: For quick programming of chips!
  3. Automatic Alerts: For updates for CCS software tools!
  4. Recent Projects: Easily open a project from the file directory where C projects are saved.
  5. News Articles: Find the most recent news articles from CCS all in one place. Catch up on the latest CCS has to offer with this handy feature!


We invite you to download the Free CCS Windows 8 App from the Windows Store today! http://bit.ly/1gq2JcO
The CCS Windows 8 App and Compiler Software Products are compatible with Windows versions 8 and 8.1.



Like us on Facebook. 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.

Tech Note: The Easiest Way to Configure Oscillators

Monday 03 March, 2014

Easily setup your PIC® MCU clock with #use delay(). This article takes a deeper look at how to set the various oscillator fuses and oscillator registers to get the clock speed specified in #use delay(). Projects get a jump start with #use delay() accepting simple keywords: CRYSTAL, OSCILLATOR, INTERNAL and RC in addition to, or in-place of, the keyword CLOCK to setup the clock.

By using one of these keywords with the clock speed causes the compiler to set the appropriate oscillator related configuration fuses and registers to automatically achieve the specified speed with the specified clock source. The following #use delay() examples demonstrate how to setup the PIC® MCU to run at 8 MHz from an external crystal and at 4MHz from the internal oscillator:

#use delay(clock=8MHz, crystal)
#use delay(crystal=8MHz) //same as above line

#use delay(clock=4MHz, internal)
#use delay(internal=4MHz) //save as above line


For devices that have a PLL, #use delay() has an easy mechanism for setting up the PIC® MCU to run from use of it. This is easily done by setting the CLOCK option to the PLL clock speed and the CRYSTAL or OSCILLATOR option to the speed of the external clock source. For example the following #use delay() line will set the clock to run at 32 MHz from an 8 MHz external oscillator using the PLL:

#use delay(clock=32MHz, oscillator=8MHz)

For devices with an USB peripheral, CCS has added the keywords USB, USB_FULL (same as USB) and USB_LOW. By using one of these keywords in #use delay() it causes the compiler to set the device's configuration fuses for the USB clock to be setup for either FULL or LOW speed. For example the following line will setup the PIC® MCU to run at 48 MHz from a 20 MHz crystal and setup the USB clock for FULL speed:

#use delay(clock=48MHz, crystal=20MHz, USB_FULL)

When using the #use delay to configure your oscillator it is not recommended to include oscillator related #fuses in your code, or the use of setup_oscillator() unless you need to change the oscillator run-time.

Like us on Facebook. 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.

Tech Note: Easily Edit using the C-Aware IDE Column Editing Feature

Monday 03 March, 2014

The Editor in the V5 IDE 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 the text within the block with new text you type on each line.

This can also be used to simply insert he same text at a given spot on a group of lines. To do that select a thin column where you want the text inserted.



Like us on Facebook. 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.

 Displaying 31 to 40 (of 148 articles)   Result Pages: [<< Prev]   1  2  3  4  5 ...  [Next >>]