PIC16F1509 and configurable logic blocks

Status
Not open for further replies.
May 11, 2008
20,272
1,151
126
If you are into microchip PIC architecture, then the PIC16F1509 might be the MCU for you. It has a small 8 pin sister that has also an insane amount of hardware.

Playing with this (enhanced architecture PIC) is fun. It pushes the most important registers into a shadow stack when servicing an interrupt. Thus no pushing and popping of registers if you only use one ISR at a time (I think this is called non reentrant but i am not sure)...
It has a "C" optimized architecture. Two 16 bit FSR's for indirect linear addressing of the entire memory (file registers and program memory).
Although with a few macro's from the very powerful MPASM assembler, you have almost the same ease of use in assembly as with c.
Which reminds me, that i have to find out the calling convention for the c compilers for microchip PIC MCU's.


What is amazing is that this chip is packed with an extreme amount of hardware packed in a 20 pin chip :

Enhanced Mid-range Core with 49 Instruction, 16 Stack Levels
Flash Program Memory with self read/write capability
High Endurance Data Flash block in lower 128 bytes of Program Memory(100,000 Writes min.)
Internal 16MHz oscillator
4x Standalone PWM Modules
Complementary Waveform Generator (CWG) Module
Numerically Controlled Oscillator (NCO) Module
4x Configurable Logic Cell (CLC) Modules
Integrated Temperature Indicator Module
12 Channel 10-bit ADC with Voltage Reference
5-bit Digital to Analog Converter (DAC)
MI2C, SPI, EUSART w/auto baud
25mA Source/Sink current I/O
2x 8-bit Timers (TMR0/TMR2)
1x 16-bit Timer (TMR1)
Extended Watchdog Timer (WDT)
Enhanced Power-On/Off-Reset
Low-Power Brown-Out Reset (LPBOR)
Programmable Brown-Out Reset (BOR)
In Circuit Serial Programming (ICSP)
Integrated In-Circuit Debug / or Use an ICD Header
PIC16LF1509 (1.8V – 3.6V)
PIC16F1509 (2.3V – 5.5V)

And on top of that , you get a sort of stripped down fpga functionality by using the (CLC) configurable logic blocks, the (NCO) Numerically Controlled Oscillator and the (CWG) Complementary Waveform Generator.

To get to work with the configurable logic blocks, microchip designed this handy dandy GUI tool.

You just make the connections and the program produces the desired values for the registers you must program.
I tested it, and it works great. You do need to be a die hard hardware enthusiast to make the best of all those logic gates.




http://ww1.microchip.com/downloads/en/DeviceDoc/CLCDesignerTool_Ver 3-0-0-2.zip


http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en553474

I cannot wait until microchip starts producing more chips (With more pins please... Mr Microchip )with configurable logic blocks.
I myself made part of an experimental MCU controlled multi smps with it. And it works great.
 

The J

Senior member
Aug 30, 2004
755
0
76
Heh, I certainly wouldn't mind having that CLC module in a PIC32! I didn't even know Microchip had that module (I work with the PIC24H and PIC32 and those don't have it). Some of the PIC24E and PIC33E have something called a Peripheral Trigger Generator, which sounds like it might be similar though I haven't looked into it.

Oh, the term you were thinking of is interrupt nesting, which can be turned on and off in the 16-bit PICs, at least.
 
May 11, 2008
20,272
1,151
126
The PIC 16F1509 is really a marvel of technology. With the free MPLABX and the free xc8 compiler it is really easy to program. I am now doing a little project for my home that involves light control. And the MPLABX is a very nice IDE to work with. For 2 euro's one can buy a 16F1509 and have fun with it. This tiny chip is packed with hardware and when put to good use, allows for fun features. Microchips Mtouch library allows touch buttons and sliders to create functionality similar to the capacitive touch screen from smartphones.

From wiki :
MPLAB X is not a new version of the current MPLAB IDE v8 framework but is instead based on Oracle's open-source NetBeans platform. In addition to its predecessor's functionalities and compatibility with Microchip's existing development tools, the new IDE utilises many NetBeans features allowing for user-interface improvements and performance upgrades. This also includes highly anticipated[by whom?] cross-platform support in MPLAB IDE, allowing development for PIC microcontrollers on Mac OS X and Linux operating systems, in addition to Windows. This IDE also support the SDCC open source compiler on the three major OS: Mac, Linux and Windows. By using the MPLABX with SDCC one may be able to set up a complete free suite for programming Microchip PIC's in C language.
 
Last edited:

Colt45

Lifer
Apr 18, 2001
19,720
1
0
I used to use PIC quite a bit, but can't stand them anymore. AVR & ARM are just so much more painless, ime.

If you like the onboard logic block idea, look into cypress' PSoC. PSoC4/5 are modern ARM cortex M0/3 ones, the older ones were 8051 cores, I think. They have a bunch of logic blocks, and a few analog blocks (dac, adc, opamps) that can be mapped to any pins. Kind of neat.

I got a demo board for PSoC4 a while back (arduino shaped and $25), but haven't had much time to play with it yet.
 
May 11, 2008
20,272
1,151
126
Yeah, the Psoc are great but so expensive. I do have to mention that the modern enhanced mid range 16 series are a lot more friendly to program in C.
And soon enhanced mid range (16 series) PIC's will be released with a math accelerator block and with an internal 32MHz oscillator.
The math accelerator block will allow for hardware multiply and CRC.
 
May 11, 2008
20,272
1,151
126
Today i made a (proof of concept)4 servo controller with the pulswidth generation in hardware by making use of the 4 clc blocks in combination with the 16 bit TMR1. The pulswidth generation is independent of the code that is running and does not change in pulswidth because of changing timings in executing loops or interrupts. All written in C and by using the CLC designer to do the necessary programming of the CLC registers. Even when the pic is doing some heavy number crunching, this does not change the pulswidth. The repeating time may vary but with modern (digitally counter based) servo's that is not an issue. Analog based servo's may possibly still jitter a bit but then the pic must really be doing some number crunching if it cannot service a timer function (to start the pulswidth generation) once every 20 milliseconds.
 
May 11, 2008
20,272
1,151
126
Yahoo ! I modified the code a bit and now it works in hardware together with an interrupt. Completely independent of the main loop code with the exception of filling 4 16bit variables with a value to set the servo pulsewidth. And because the PIC allows smart multiplexing between functions on the same pin, More hardware can be used even with limited pins.
 
May 11, 2008
20,272
1,151
126
I made a 4 servo, servo controller by making use of the 4 clc blocks. I use the uart with a built in menu to control it and calibrate it. I have also an proof of concept idea to make an 8 servo, servo controller by making use of a multiplexer and the clc blocks. This one is also controlled and calibrated by uart and built in menu. Because the servo pulse width are generated by the clc blocks and timers in hardware, the timing of the program is not critical and easy to program for. No cycle counting is needed. Just general C programming to get it running.

I also made a proof of concept 230v mains trailing edge dimmer with 2 mosfets, that has touch inputs to isolate the buttons from the user by the plastic housing. The touch inputs control the phase of the trailing edge dimmer.
 
Status
Not open for further replies.
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |