CCS News RSS

CCS is Ready for Microchip's Overhaul of the PIC18 Family - PIC18F24K42!

Friday 26 May, 2017

The CCS C Compiler now support the PIC18F24K42 family of devices. Currently available devices have up to 32 KB of Program Flash Memory, 256 B of Data EEPROM and up to 2 KB of Data SRAM. Additionally they have 25 I/O pins, 24 12-bit ADC channels, 1 5-bit DAC, 2 Comparators, 3 8-bit Timers, 3 16-bit Timers, Windowed Watchdog Timer, Signal Measurement Timer (SMT), 4 CCP peripherals, 4 10-bit PWM peripherals, 3 Complementary Waveform Generators (CWG), Numerically Controlled Oscillator (NCO), 4 CLC peripherals, Zero-Cross Detect, 2 UART peripherals, 2 I2C peripherals and 1 SPI peripheral.

Additionally each of the I/O pins can be assigned to almost any peripheral using the CCS C Compiler's #pin_select directive make it highly configurable for your specific hardware implementation. Future devices in this family will have up to 128 KB of Program Flash Memory, up to 1 KB of Data EEPROM, up to 8 KB for Data SRAM, up to 44 I/O pins and up to 43 ADC channels. 8KB of RAM is a significant upgrade for the PIC18 family, as previously the architecture only supported 4KB of RAM.

The newest feature that this family has is an optionally enabled interrupt vector table (IVT). The IVT allows for quicker entry into a peripheral's interrupt service routine (ISR). Normally the compiler has to search through the interrupt enable and interrupt flag bits to determine which peripheral caused the interrupt in order jump to the correct ISR. When the IVT is enabled each interrupt has a specific address it will go to when an interrupt occurs which contains the address of that peripheral's ISR, which makes servicing the ISR faster. The IVT can be enabled for these device in the CCS C Compiler by adding #device vector_ints to the code for this family of devices.


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 Compiler Makes It Easy To Calculate a CRC Using the PIC® MCU's CRC Module

Friday 26 May, 2017

Reliably sending data between two devices usually involves a checksum. Creating a checksum of data is a great way to detect if data has be successfully received; by comparing a received checksum to a mathematically determined checksum it can be determined if the data was sent and received properly. A common and easy method of performing a checksum is just summing or XORing all the bytes in the data. Unfortunately this method does accurately detect situations where data may have been received correctly. For example, the result of 0 XOR 0 is still 0. That means a checksum based on XOR would couldn't tell the difference between 0x0000 or 0x00.

The Cyclic Redundancy Check (CRC) is a more robust method for hashing data. In reference to the previous example, the CRC of 0x0000 isn't 0x00. Many new PIC® MCUs released today include a CRC module that perform this algorithm quickly in hardware, and CCS provides a library for accessing this module.

There are two basic versions of the CRC module that some Microchip PIC® MCUs have, a 16-bit module and a 32-bit module. The following getenv() statement can be used in the CCS C Compiler to determine if the device has a CRC module:

getenv("CRC") //will return 1 if it device has a HW CRC module

Both version of the CRC module has a programmable polynomial CRC equation, for the 16-bit modules the polynomial can be up to 16 bits wide and for the 32-bit modules the polynomial can be up to 32 bits wide. The setup_crc() function can be used in the CCS C Compiler for setting up the CRC polynomial. For example the following will setup the CRC module to generate a checksum using the CRC-16 CCITT polynomial, x^16 + x^12 + X^5 + 1:

setup_crc(16, 12, 5, 0);

To calculate the CRC checksum the CCS C Compiler supplies the following functions, crc_calc8(), crc_calc16 and crc_calc32(), for devices with a 32-bit CRC module only. The function that should be used depends on the polynomial size that was set with the setup_crc() function. For polynomials that are 8-bits or less the crc_calc8() function should be used, for polynomials that are greater then 8-bits and 16-bits or less the crc_calc16() function should be used and for polynomials that are greater then 16-bits and 32-bits or less the crc_calc32() function should be used. Additionally the crc_calc8(), crc_calc16() and crc_calc32() have an optional parameter that allows setting the width of the data that the CRC checksum is being calculated for, the data width defaults to the width the function, 8-bits for crc_calc8(), 16-bits for crc_calc16() and 32-bits for crc_calc32(). Finally the CCS C Compiler supplies that crc_init() function that is used to set the initialization value of the CRC generator. This function should be called before every call to one of the CRC calculation function to guarantee correct results.

The following is an example of using the CRC module to generate a 16-bit CRC for some 8-bit data that will be transmitted with the UART peripheral:

#use rs232(UART1, baud=9600, errors)
#define START 0x01
#define END 0x0D
void tx_data(unsigned int8 *Data, unsigned int8 Length)
{
unsigned int16 CRC;

crc_init(0);
CRC = crc_calc16(Data, Length, 8);
putc(START);
printf("%s%04LX", Data, CRC);
putc(END);

}

void main(void)
{
unsigned int8 Data[32];
unsigned int8 Length;
unsigned int16 Count = 0;

setup_crc(16, 12, 5, 0);

while(TRUE)
{
Length = sprintf(Data, "Count=%lu,", Count++);
tx_data(Data, Length);
delay_ms(100);
}
}


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.

EZ App Lynx Update 3.0

Thursday 06 April, 2017

The EZ App Lynx compiler libraries, Android Application, and iOS Application have all been updated to to version 3.0! This version includes three new field types to be used in the app.

The first new addition is the Image field. This allows the app to load images from the web or use some of the already preloaded images in the application bundle. Images loaded from the web are cached on the device so they only need to be downloaded the first time a connection is made. Image fields can be used to display plain images, or the images can be used as buttons. Button images can be one-state or two-state buttons acting similar to the normal button fields. These fields allow two separate images to be loaded, where the first is the "on"/"pressed" state and the second is the "off"/"unpressed" state. If only one image is specified, the image field uses the same image for both states. See EZApp.h and ex_ezapp_images.c included with the current CCS C compiler for more info on how to use the Image fields.



The remaining two new fields are the Graph and Series field types. Together these allow for adding bar graphs and line graphs to the application. The Graph field sets up the graph type, grid lines, labels, data ranges, etc., while the Series field sets up how the data will look on the graph, including color, line type, and series name. Multiple Series fields can be tied to one Graph field, allowing for multiple data sets to be shown on the same graph. See EZApp.h and ex_ezapp_graphing.c included with the current CCS C compiler for more info on how to use the Graph and Series fields.



More information about EZ App Lynx, visit: http://www.ccsinfo.com/content.php?page=ez-app


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.

Serial Numbering During Production Made Easier!

Thursday 06 April, 2017

Serializing devices in a production environment is simple and easy using the CCS C Compiler and the Prime8 Production Programmer. The CCS C Compiler allows for setting up serialization using the #serialize preprocessor directive. A serial number can be saved in binary or as a string, and can be stored in ROM or EEPROM if available.

This example shows a simple way to store a 32-bit binary serial number (4 bytes) in either EEPROM or ROM. The target device has 256 bytes of EEPROM and 32Kbytes of flash program memory, where the serial number is stored in the last 4 bytes of either depending on the defined location. The #ORG in the ROM variant is to reserve the program memory containing the serial number from being used elsewhere by the compiler.



Reading a binary serial number from memory is as simple as reading the raw data directly into a variable using a byte-pointer to that variable. In the example, a pointer is created to a 32-bit variable, which is used to index the raw data bytes. The result is the 32-bit number set by the programmer.

The serialization settings, or "burntime" settings, are saved in the hex file on compilation and are loaded into the Prime8's internal memory when writing the hex file to it. The initial serial number can then be set or changed on the job configuration screen.

Serial numbers are automatically incremented after each successful write, so each connected target will have a different serial number written to it.



To change the current serial number on the Prime8, select the Config button for the current job. On the Config screen, the file can be selected by touching the "Name/Location" setting, choosing "Internal Memory", and selecting the memory slot the file was written to. This will then show the file name and location on the Config screen. Touch the down arrow until the "Serial Number" setting is visible. Touch this setting to open a keypad where a new serial number can be entered. Once the number is entered, Press the Enter button to save the setting.



Now when the program is written to the targets, the serial number that was entered will be the first serial number written (in this case, 65536), and each successive target will have an incremented serial number (65537, 65538, ...). The number can always be changed or reset by changing the setting again under the job configuration screen.

Prime8 Production Programmer, visit: http://www.ccsinfo.com/product_info.php?products_id=P8_gang
CCS C Compilers, visit: http://www.ccsinfo.com/content.php?page=compilers


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.

New! Touchscreen Development Board and Interface Designer GUI

Wednesday 11 January, 2017

CCS has a new software package, Interface Designer, available as part of the IDE compilers. Now users are able to create elaborate Graphical User Interfaces (GUI) with the aid of Interface Designer's user friendly interface. The innovative program eliminates the need to create a GUI entirely from developing C code by allowing users to create a GUI visually within Interface Designer itself.

Touchscreen on PC

Interface Designer brings user friendly up a notch with its easy to use interface.

  • Import custom images or chose from the library of images for use with your GUI.
  • Effortlessly create buttons and text boxes with Areas. (A coordinate defined location that registers user touches on the touch screen)
  • Implement as many different screens to be used as desired with any amount of Images using Windows, containers that visually display on the touch screen.
  • Add Actions allows the defined Area to execute when touched on the touch screen.
  • Generate the appropriate C code with one click of a button.


Interface Designer has been designed around the new Touch Display development board developed by CCS. Find the Development Kits or LCD Board here: http://www.ccsinfo.com/product_info.php?products_id=touch-kit
Touch Display 4.3 Prototyping Board
This new development board includes a 4.3" resistive touchscreen with a 480x272 screen resolution and all the hardware necessary to run the most innovative of GUI's. With all the components situated on one development board, the Touch Display gets rid of the typical need to connect a separate microcontroller to an external touch screen display, saving space.

CCS has designed a signature kit for the use of the Touch Display development board which includes all of the necessary hardware and software for successful developing and has included Interface Designer as part of the CCS C Compiler.


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.

The Prime8 Production Programmer gets some 'touching' updates

Wednesday 11 January, 2017

The Prime8 has gone through a redesign to make it better than before! The Prime8 production programmer is a gang programmer than can program 8 PIC® MCUs simultaneously. It can operate via software control over a USB connection, or it can operate without a PC by storing files inside its memory.
Prime8
The most impressive update is a touch screen LCD, featuring a much simpler and easy to use user interface. This new UI makes it easy to choose a file and program a file, as well as making it easier to configure the unit. The UI has also been upgraded to show more information about the files stored in its memory.

The speed at which PIC® MCUs can be programmed are also improved. For instance, programming a full PIC24EP256GP206 results in almost 75% reduction in time when using the new Prime8 versus the older models.

The internal memory has been upgraded to 8 megabytes, allowing the user to store eight 1 megabyte files (an improvement over the 2 megabytes and four files of the older models). If a file is larger than 1 megabyte, it can still be stored by using multiple slots of the Prime 8's internal memory. If 8 megabytes of memory isn't enough, it can be expanded using a USB thumb drive connected to the Prime8.

Available Now! Visit: http://www.ccsinfo.com/product_info.php?products_id=P8_gang


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.

Utilizing the new Signal Measurement Timer (SMT) PIC® MCU peripheral with the CCS C Compiler

Tuesday 06 December, 2016

The Signal Measurement Timer (SMT) is a powerful new timing peripheral found on several of the newer PIC® MCU devices, such as the PIC16F18877 and PIC18F67K40 families. Each SMT is a 24bit timer that can operate in one of several modes:

* Timer - A simple 24bit timer, similar to the Timer0 or Timer1 peripheral.

* Gated Timer - Like timer mode above, but only increments when the signal GPIO signal is high.

* Period and duty cycle measurement - Like gated timer, increments a counter when the signal GPIO signal is high. But when the signal GPIO goes low, the timer value is stored for future use and the counter is reset back to 0.

* High and low measurement - Similar to Period and duty cycle mode above, but resets and stores on every signal edge.

* Window Measurement - akin to period and duty cycle measurement above, but measures time between two rising edge signals on the window GPIO pin.

* Gated window measurement - Like window measurement above, but time only increments when the signal GPIO pin is high.

* Time of flight - Similar to window measurement, but timing starts when the window GPIO pin goes high and the timer is stored and reset to 0 when the window GPIO pin or signal GPIO pin goes high.

* 24bit capture - Simply stores the timer value when the window GPIO pin changes state.

* 24bit counter - Counts all the rising edges of the signal GPIO pin.

* Gated counter - Comparable to the 24bit counter mode, but only increments when the window GPIO pin is high.

* Windows counter - Like the gated counter mode, but a rising edge of the window GPIO pin will store the existing timer counter and then reset it to 0.

The CCS C Compiler has been updated to add a library that allows for controlling, configuring and using the SMT in your PICmicro C projects. The functions that have been added are setup_smtX() (or setup_smt1() to setup the first SMT peripheral), smtX_status(), smtX_start(), smtX_stop(), smtX_update(), smtX_reset_timer(), smtX_read() and smtX_write(). For more help, refer to the CCS C Compiler Help file for documentation.

Here is an example of using the Timer mode to blink an LED at a 1Hz rate:

#define LED_PIN PIN_B4
#define SMT_PERIOD (getenv("CLOCK") - 1)

#INT_SMT1
void my_smt_isr(void)
{
output_toggle(LED_PIN);
}

void my_smt_init(void)
{
setup_smt1(SMT_ENABLED | SMT_MODE_TIMER | SMT_CLK_FOSC, SMT_PERIOD);
smt1_start();

enable_interrupts(INT_SMT1);
enable_interrupts(GLOBAL);
}

The CCS C Compiler also provides 2 full example programs showing how to use the SMT, which can be found in the examples directory of the CCS C Compiler. First ex_smt_timer.c which is an example of using the SMT peripheral in Timer mode to toggle an I/O pin, and second ex_smt_period_duty.c which is an example of using the SMT peripheral in Period and Duty Cycle Acquisition mode to determine the period and duty cycle of an input signal.

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.

Capture Event Timers with the CCS C Compiler

Tuesday 06 December, 2016

The Capture Compare (CCP) peripheral of the PIC16 and PIC18 PIC® MCUs and the Input Capture (IC) peripheral of the dsPIC and PIC24 PIC® MCUs allow the MCU to capture and hold a timer value when a specific input pin reaches a user defined state. This peripheral is useful for measuring the duration between events, or determining the frequency or duty cycle of an incoming signal. This peripheral operates independent of the MCU operation, meaning it can trap the timer on the input signal without the developer having to block code execution waiting for the input signal to happen.

Version 5 of the CCS C Compiler has added a #use capture() library that makes it easy to use the CCP or IC peripheral. The API for this library provides an easy to use method for using and configuring the peripheral and timers, while also being portable from one PIC® MCU device to another. Here is an example of its use:

#use capture(CCP1, input=PIN_C2, capture_rising, stream=CAPTURE1)

unsigned int16 WaitForEvent(void)
{
while(!get_capture_event(CAPTURE1));
return(get_capture_time(CAPTURE1));
}

#use capture() configures a CCP or IC peripheral for use, and by using the STREAM option several peripherals can be configured with several instances of #use capture(). #use capture() also provides a method of configuring the timer peripheral to use and the tick rate of the timer. Several other configuration options exist, see the compiler help manual for documentation.

get_capture_event() returns TRUE if the CCP or IC peripheral has trapped an event that can be read, and get_capture_time() returns the time the event happened.

The CCS C Compiler provides an example of using this library, ex_use_caputure.c which can be found in the examples directory of the CCS C Compiler. This example can be used on any PCM, PCH or PCD version 5 CCS C Compiler.

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.

NEW! ICD-U80 Programmer/Debugger

Friday 14 October, 2016

ICD-U80
Sku: 53506-1648
Price: $119

Introducing the new ICD-U80 Programmer/Debugger from CCS. The advantages of the ICD-U80 include:
  • Accelerated programming speed
  • Integrated Vdd generator to supply 1.5-5.5V to target
  • Software controlled power to target - no jumpers to change

Check out the complete line of CCS Programmer/Debuggers to fit your needs. http://www.ccsinfo.com/programmers-debuggers.php


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.

Add Non-Volatile Storage to Any PIC® MCU with the virtual EEPROM driver

Tuesday 07 June, 2016

Looking to store settings or data in your embedded project, but you are using a PIC® MCU without an internal EEPROM and your design doesn't have an external EEPROM? The virtual EEPROM driver included in the CCS C Compiler adds the ability to use the PIC® MCU's re-programmable flash memory as data storage. This driver also performs write balancing, which allows the developer to write to a specific location several times without fear of wearing out the endurance of the flash memory. The virtual EEPROM driver recently was updated to add support for PIC16 and to optimize the memory usage when used on 8-bit PIC® MCUs (PIC16, PIC18, etc).

To add this library into your project, simply #include the file virtual_eeprom.c. The function init_virtual_eeprom() needs to be called to initialize access to the virtual EEPROM. write_virtual_eeprom() can be used to write a value to a location, and read_virtual_eeprom() can be used to read the value at a specified location. The last two erase pages of the PIC's re-programmable flash are used as storage for the virtual EEPROM system.

Here is an example of usage:

#include <virtual_eeprom.c>

void test_virtual_eeprom(void)
{
init_virtual_eeprom();
write_virtual_eeprom(0, 55);
write_virtual_eeprom(1, 65);
write_virtual_eeprom(2, 75);
printf("%urn", read_virtual_eeprom(0)); //should say '55'
printf("%urn", read_virtual_eeprom(1)); //should say '65'
printf("%urn", read_virtual_eeprom(2)); //should say '75'
}

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 146 articles)   Result Pages:  1  2  3  4  5 ...  [Next >>]