CCS News RSS

18th Annual Microchip MASTERs Conference and CCS Class

Tuesday 12 August, 2014

CCS, Inc. will be presenting at the 18th annual Microchip's MASTERs Conference this August 20-23 in Phoenix, AZ. The focus this year is The Internet of Things which is ideal to showcase our new Wireless Sensor Control App using the CCS IDE which allow users to easily create a Smart Device App that pairs to your PIC® for reading field data on the fly. Also, our EZ Web Lynx Modules enable you create the Internet of Things, very quickly, using either a Wi-Fi or Ethernet Module add-on and HTML programming to get your product to the Internet.

Darren Rook, CCS Lead Engineer, will be teaching a class on converting Assembly Code to C using the CCS IDE. Attendees of the Using the CCS C compiler for painless migration from Assembly to C Class will learn how to convert Assembly to C using a sample Assembly application for the PIC16F1XXX. Darren will demonstrate in a step-by-step fashion how to implement the necessary constructs in C. Techniques will be covered specifically for the CCS C compiler. For the hands-on portion of the course, participants will experience the speed and ease of developing applications from scratch, using the CCS C Compiler. Also covered will be the use of the application Wizard, basic IDE use, programming concepts and advanced debugging techniques, as well as new features of the IDE.

For more information on the conference, to register, or to sign up for the CCS class, please visit the Microchip MASTERs website.

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: Using addressmod() to allocate variables in a PIC® MCU access bank

Thursday 10 July, 2014

The CCS compiler addressmod() feature allows you to define custom memory spaces. This new function that replaces the older typemod() function now makes it easy to use the shared bank memory in many processors for specific variables your code uses. addressmod() allows for faster access to those variables.

addressmod(), supported in the CCS C Compiler, provides embedded C developers a way of declaring variable types with many custom parameters like specific read and write functions or memory ranges. This is useful in embedded applications because there are often several types of memory available in a design that need to be accessed, like RAM, ROM, EEPROM, Flash, and even LCDs. This article highlights a few details of addressmod(), for full details refer to the CCS C Compiler manual.

Recently the CCS C Compiler added a new optional parameters to addressmod() called 'share'. If this option is defined as TRUE, the CCS C Compiler will allow the addressmod() declared variable type to also be used by other variables but the addressmod() declared variables will have to be allocated in that region first. This is useful for the access of bank memory described above, as a developer may want to have some variables allocated in this region but leave it available for the compiler to use the remaining space for other variables.

The usage is:

addressmod(name, read_function, write_function, start_address, end_address, share);

Here is an example:

#if defined(__PCM__)
addressmod(near, , , 0x70, 0x76, TRUE);
#elif defined(__PCH__)
addressmod(near, , , 0x20, 0x5f, TRUE);
#elif defined(__PCD__)
addressmod(near, , , 0x1000, 0x1fff, TRUE);
#endif

near char flags;
char option;

The addressmod() code above can be copied and pasted into your projects to define a 'near' memory region that uses the PIC® MCU access bank.

'near' is an addressmod() created memory region that sits in the PIC® MCU access bank. Pre-processor #if / #else is used to make a 'near' for every applicable PIC® MCU architecture. Since the 'share' flag in addressmod() is set TRUE, the compiler will make this memory region available for general use once 'near' variables have been allocated. The variable 'flags' uses the 'near' memory region, meaning 'flags' is placed in the access bank. The 'option' variable does not have a memory region specified, so the compiler will use any RAM region available. If the user allocated more variables than can be saved in the 'near' region, the compiler will generate an 'Out of RAM' error message.

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: Function overloading with ROM and RAM pointers

Thursday 10 July, 2014

The CCS C Compiler supports C++ like function overloading. Function overloading allows the user to develop two functions with the same name but have different parameters or return types. Recently the CCS C Compiler updated the function overloading to distinguish between RAM and ROM pointers as well. This is useful on the PIC® MCU which uses the Harvard architecture, meaning accessing the RAM and ROM is different. Since accessing RAM and ROM is different, the compiler needs to know which one the user is accessing so it can use the proper method.

Here is a simple example of function overloading using ROM and RAM pointers:

int1 Checksum(rom char* pRom, int hashCompare) {
int hash = HashCalculateRom(pRom);
if(hash == hashCompare)
return 1;
else return 0;
}

int1 Checksum(char* pRam, int hashCompare) {
int hash = HashCalculate(pRam);
if(hash == hashCompare)
return 1;
else return 0;
}

SetSavedString((rom char*) "Hello World");
SetSavedString((char*) "foo bar");

Checksum() has two functions, one for handling ROM pointers and one for handling RAM pointers. In the CCS C Compiler the 'rom' keyword specifies the ROM flash memory, if this is not specified the CCS C Compiler will use RAM. When Checksum() is called with the "Hello World" as a 'rom char*' It passes the pointer to the HashCalculateRom() method, that calculates the hash value for the pointer and compares it to the hashCompare value passed in by the user. The same is done when "foo bar" is passed in as a 'char*' but it passes the pointer into the HashCalculate() method that is used for RAM locations. If the calculated hash matches the user input hashCompare, then Checksum() returns '1', otherwise it returns '0'.

Here is a more complex example of function overloading based on ROM and RAM pointers:

struct {
union {
rom char* pRom;
char* pRam;
};
int1 isRom;
} savedString;

void SetSavedString(rom char* pRom) {
savedString.pRom = pRom;
savedString.isRom = TRUE;
}

void SetSavedString(char* pRam) {
savedString.pRam = pRam;
savedString.isRom = FALSE;
}

void PrintSavedString(void) {
if(savedString.isRom)
printf("%s", savedString.pRom);
else
printf("%s", savedString.pRam);
}

SetSavedString((rom char*)"Hello World");
SetSavedString((char*) "foo bar");

SetSavedString() saves a (char*) or (rom char*) depending on what was passed in by the user to memory, and sets a flag denoting the type of pointer that is being used. The PrintSavedString() checks the flag to select the proper pointer, and prints the string.

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: Real Time Serial IO Monitor

Tuesday 27 May, 2014

C-Aware IDE Compilers are able to read data streamed to a PC where it can be plotted in real time using the IDE's Serial Input/Output Monitor. From the 'Tools' ribbon launch the Serial Input/Output Monitor program, which is a powerful and easy-to-use serial port terminal program. Serial Input/Output Monitor allows the user to easily connect to a serial COM port or telnet port.



The Data Graph in the screenshot above was generated using the following code:

#include "e3mini.h"

#define GRAPH_TITLE "Sin Graph"
#define GRAPH_SERIES1_TITLE "Sin"
#define GRAPH_SERIES2_TITLE "Cos"
#define GRAPH_X_MIN "0"
#define GRAPH_X_MAX "719"
#define GRAPH_Y_MIN "-1"
#define GRAPH_Y_MAX "1"

#include <graph_siow.h>
#include <math.h>

void main (void) {

init_graph();

for(int16 z = 0; z < 720; z++) {
graph_points3(sin((z*3.14)/180), cos((z*3.14)/180));
}
}

Serial Input/Output Monitor also offers advanced features such as file transfer, microcontroller boot-loading, macros, logging, and graphing. Devices capable of outputting comma delimited ASCII data through a USB or RS-232 port can have their output displayed in real-time on a graph from within the IDE. The device can be connected directly to the PC's USB or serial port; no debugger or other hardware is required. This capability is especially useful when debugging data acquisition systems and sensors, motion control systems, etc.

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: 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.

 Displaying 1 to 10 (of 122 articles)   Result Pages:  1  2  3  4  5 ...  [Next >>]