Tuesday, March 6

EasyPIC v7 review

What's new and what isn't

In this article I will review the new EasyPIC v7 development board from Mikroelektronika. I will compare it to the previous version, will look at the new design, take you through what is on board and what is no longer there and finally give you a general overview of it.

I really do not believe Mikroelektronika needs any more publicity on the EasyPIC v7, but I felt it would be nice to go through reviewing the new board my way and most importantly compare it with its predecessors!
Now, I am not going to compare them since the beginning of time, also because I jumped on board of the EasyPIC wagon only as of version 5, but I think it is nice to visually analyse the evolution of the board across  the various versions it went through. Quite an impressive progression really! The quality of photography too :)

EasyPIC2 EasyPIC3
EasyPIC4 EasyPIC5

EasyPIC6 EasyPIC7

Layout considerations
The designers of these great boards will hopefully forgive me if the considerations in this section may sound quite superficial, but I would first of all just give simply a visual impression of the various layouts without going in the details of why from an engineering point of view things were placed here or there. So with this in mind this is what I see:

It is interesting to notice how the various elements did and did not move from board to board. The layout of the EasyPIC2, 3, 4, 5 and 6 did not really change too much overall especially when compared to Version 7 which is without doubt the exception.

Led and buttons have always been bottom left but not in version 7 in which they have been placed in the ports area on the right.

The chip sockets more or less had been kept in the centre. One thing of note is that the EasyPIC5 as well as v7 have enough space for my trusty 40 pin zif socket to fit in. The EasyPIC6 would not allow it because the switch above the socket was really too close.

EasyPIC5, 6, 7 40 pin sockets side by side
EasyPIC v7 with zif socket
EasyPIC5 with zif socket

The ports were top to bottom on the right, quite so in version 7 too but now you have two connectors and a proto header per port plus another connector per port on the left! No wonder, their theme for this version is connectivity!

The LCD spot of the EasyPIC 2 was taken by the GLCD in the EasyPICS 3,4,5 and 6 sending the LCD towards the top left area. I presume the GLCD was also the reason why the form factor as of the EasyPIC3 became bigger. Whereas the LCD is quite in the same place on version 7 too, the GLCD has taken the place of the buttons and led.

With regards to size wise apparently the boards are growing over time. The EasyPIC5 measured 25x21 cm, the EasyPIC 6 and v7 are both 26.5x22 cm.

The on-board programmer and the power section area made it to the version 7 keeping the same spot. Interestingly the on-board programmer has now a "warranty void if removed" shield. I am not sure I like it, even in the manual it is represented as a "black box". Could this be for copyright?

The external communication connectors have also kept their space exception made for the serial port which as of version 6 is in the top left corner.

The 7 segment display was "less lucky" it travelled quite a bit and at one point it made it off the board entirely. Welcome back in v7!

Similar sort had the DS1820 which every time was really placed where there was space left.

The AD converter trimpots have remained pretty much where they were from version 2 to 5 and to 6 although in this version one was removed. In version 7 they have been moved together with the other two trimpots for the GLCD and LCD in a column next to the displays area.

A more rational design

As you can understand by now, version 7 was quite revolutionary in its design. It grouped elements in functional areas much more than any of the previous versions and sacrificed some gadgets that were introduced in version 6, towards usability and a rational layout.

EasyPIC v7
The switches area is also all in one place, exception made for the new tristate port switches. I am sure this arrangement, along the lines of the grouping of displays and trimpots, will be much appreciated especially by beginners.

I haven't used the new board too much yet but it looks to me that after a bit of readjusting my habits to the new layout it should be much easier to use. It shows some radical re-thinking of the board which must have taken some major effort and courage from Mikroelektronika. I am sure it will pay of.

Having port connectors to the left and to the right is really nice, you can now spread your work on each sides of the board. Often you have far too many things on the right of the board  when you are working with complex projects and several accessory boards. Having port connectors on the left will surely help to have a much neater workbench.

What is and was on board

The new board comes with the usual PC keyboard, USB and serial port connectors and the Ext ICD provided as of version 6. A notable new addition is the new UART via USB based on the FT232RL chip. I would not be surprised to see the RS232 disappear from a future version 8 but I certainly hope it doesn't. Dinosaurs like me grew to love it and might be difficult to part from the good old connector.

At the end of his EasyPIC6 review Roman  makes a list which in part turns out spookley prophetic!
According to him the perfect board should have had amongst other things:

2 AD converter trimpots as in the past versions
A piezo buzzer
An I2C eeprom

... and as if by magic you find all of the above on the EasyPIC v7! I couldn't agree more, those things were needed and are a welcome addition.

Another addition is the LM35 socket for an analogue temperature sensor, was it really needed?  I am not entirely sure but if anything it is another way of using the ADC and it does not take too much space.

The theme of connectivity Mikroelektronika has provided the EasyPIC v7 with five time as many ways of connecting accessory boards, prototypes and what have you to their five base ports.
Five ways because each port headers is replicated twice on the right and once on the left of the board,  plus on the proto connector. Last but not least the new mikroBUS sockets, something new and unique to this generation of boards.
EasyPIC v7 port group
The only doubt I have here is whether the two port headers on the right were necessary at all time or if maybe a couple of EasyTEST would have been enough when needed.

EasyPIC v7
mounting hole
EasyPIC v7
GND point
With a workbench in mind and certainly for an educational setup, version 7 added four mounting holes to the corners of the boards. Nice touch!

Anybody who has done any measurements on the previous boards would certainly welcome the additional GNDs point, this is something I have personally been waiting for. Much appreciated indeed.

EasyPIC5 DIY spacers
EasyPIC v7 plastic spacer
Attention to details made so that as of the EasyPIC6 a couple of plastic display spacers were installed on the board. This was indeed a nice addition especially when using the touch screen for the GLCD without resorting to diy as I did for my EasyPIC5.

The dramatic redesign of the board came with some sacrifices and claimed some victims.
The menu and the 4x4 keypads, the port expander and the COG display had short life. Newly introduced in version 6 they have already disappeared. Let me attempt to guess why that was and how can one live without.

EasyPIC6 keypads
Keypad 4x4 board
With regards to the keypads I can see two possible reasons to why you really do not need to have them on board. The first is that an Keypad 4x4 Accessory Board is available if you really need to develop applications that need those keypads. Having it on board at all time was probably not needed. The second is that UIs are shifting to touch screen and one could make use of the GLCD more and more instead of using the buttons. Either ways I don't think too many people are going to be missing the two keypads too much.

EasyPIC v7 with COG
The COG has been removed in favour of the return of the 7 segment display. I must agree with Gavin from MCU Store here, the replacement had probably been triggered by the fact that educational establishment love teaching multiplexing and strobe of I/O lines. Roman made a good point with regards to using the COG as a debugging display when using the main LCD as the normal output of the application. Personally, when possible, I tend to use the serial port as a way to do debugging over a terminal, if anyway you feel you cannot do without the COG there is now an accessory board COG 2x16 LCD Board which brings it back on one of the many port headers available on the EasyPIC v7.

EasyPIC6 Port Expander
Port Expander Board
The other missing element is the port expander. I fully support the decision to remove them to make more space and rearrange the board in such a nice way. As for the previous elements there is a Port Expander Board and the new Expand Click that can be added should you need further connectivity to the one already provided!

Expand Click

I hope by now I have convinced EasyPIC6 owners to upgrade to v7. The new board has a few element less than the previous one but all there was can be added if needed. Some of the things added to the current version are unique to it and make so that the board is more professional, usable and expandable than each previous version ever was.

The EasyPIC v7

I bought my EasyPIC v7 from MCU Store which is the UK distributor for Mikroelektronica's products and had a really nice and friendly chat with the owner Gavin, asking for his personal view on the new board in light of writing this article. He kindly provided a few good points, not a surprise giving his knowledge of this kind of products. Amongst his comments he pointed me to the EasyPIC6 review from Roman Black which I would really invite you to read and was an excellent source of material for this review.

The EasyPIC6 introduced the SMD technology which contributed to a neater and more compact design. With the EasyPIC v7 this is taken to a further level. Click Boards are all SMD and through hole technology is gradually disappearing from the rest of the more traditional accessory boards.

How does it feel

The board is build to last and gives the impression of being quite sturdy in general, the buttons feel nice to the touch, they make a clicking noise when pressed and are to me of better quality then in previous version. With regards to buttons, the reset has been moved to the top right corner of the board far away from other buttons and in my opinion in a better position to avoid pressing it accidentally.
EasyPIC v7 tristate switch
The new tristate switches allow for pull-up/down or disable for each pin. Disable a single pin was not possible before. I find them a bit too small and fiddly to use with just the fingers which I could with the previous version of dip switches, you will probably need a pen or some tool to set them. On the contrary of what I thought it is pretty easy to put them in the middle position. Overall however the previous type of switch, which is still use on board for the configuration of the board, felt better to use.
I had to send back the first board I received because one of the trimpot knobs was broken, which can happen, but most annoyingly the LCD one was really quite loose and when measured it turned out to be faulty. The values on the ohmmeter where jumping all over the place when adjusting the resistance.The new board I received is fine but the trimpots still feel quite loose, maybe it is just a bad batch and hopefully the majority of the boards will be fine.
EasyPIC v7 dip switch
The LCD and the GLCD have not changed, the backlight though has and it is now possible to choose between Standard or PWM driven!

The documentation provided is, as always, of really good quality. Incredibly detailed and really easy to go through. For those who are not familiar with the board they would be able to get up to speed with it in no time.
In writing this review I have noticed however that for this version of the board there are practically no high resolution pictures like there were for the EasyPIC5. I think it is a shame it is no longer available and hope Mikroelektronika might reconsider adding it again.

EasyPIC5 Layout

The schematic is absolutely excellent, I would really love if it were printed on a single page to "plaster" on the wall and keep as constant reference.
The package also includes a CD with all the software needed for you to start working with the board. To be in line with the excellent material provided in the box, all the software present on the CD I have received was up to date.
Some of the new aspects of the EasyPIC v7 have already been listed above, a radical new design , new components and the connectivity theme. Three of the most important new entries are however the 18F45K22, the dual power supply and the mikroBUS.

The 18F family

Already with the EasyPIC6 there were examples for which the 16F887 had become too slow and too small. Back then the replacement of choice was the 18F4520 which in turn had replaced the 18F452. Moving to top range of MCUs I guess must have been on the horizon for some time and the new board embraces the 18F family as their default by shipping the board with an 18F45K22.
The 18F family MCUs are still 8-bit but offer a much wider 16bit instruction set, they are faster and have bigger RAM as you can gather from the following table. On the Microchip website you can find all the information you need and much more.

The dual power supply

The EasyPIC6 changed the power supply from a 7805 voltage regulator type to a switching one. On my EasyPIC5 I had to add a heatsink to reduce the temperature of the voltage regulator, reading Roman's article I realise it probably was common practice. The new switching power supply meant this problem was gone and
that the range of input voltages had also increased as shown in the table below.

EasyPIC v7
With the EasyPIC v7 the power supply section has been further improved. There is now an additional crew terminal connector but most importantly you can now choose between 5v and 3.3v output voltages increasing the number of supported microcontrollers.

The mikroBUS

Mikroelektronika is putting quite some energy in promoting this new bus, many new Click boards compatible with  this novel "plug and play" connector. 
EasyPIC v7 mikroBUS
I find the mikroBUS to be quite interesting particularly considering the spreading use of shield-like boards that are now on the market. I am not entirely clear whether "shield" has been copyrighted just for the Arduino, reason for which others including Mikroelektronika have opted for alternative names, but these sockets are indeed very similar. It is quite nice to have piggyback modules like the Click boards. It is a really neat way to have the add on board built around its connector. It makes it look a lot more like a component to the main board than the previous accessory boards ever were.

Shield-like boards

Wrapping up

I think Mikroelektroinka has done overall an excellent job with the EasyPIC v7 in delivering a mature product, strong of many years of experience and of a large community continuously contributing to improve the board and its software platform.
The quality of the build is indeed very good, the attention to details and the look and feel are excellent.
Some things have left the board from the previous version, some have returned from the past, however the EasyPIC v7 is not simply an upgrade from previous versions instead its designers have managed to bravely approach a new layout which makes version 7 a complete shift towards a truly professional development board.

Monday, February 20

EasyPIC v7 configuration backup

As promised I have created a layout for the EasyPIC v7.

Changes from the EasyPIC6 tool:

Proto Header: The usual 10 connectors are there but now are in line
Tri-state DIP switches: Flip the switches for pull up or pull down, delete the switch for the centre position.

Sunday, January 29

Mikro C floating point from Microchip to PC

Many people out there have done this in many ways, I'd like to show how I have implemented it in Mikro C Pro.

The IEEE754 standard says:
1 bit sign
8 bit exponent
23 bit mantissa

Microchip variation:
8 bit exponent
1 bit sign
23 bit mantissa

so a number like -4.4 in Microchip hexadecimal representation would look like:

81 8C CC CD 

which in memory is stored CD CC 8C 81 as you can see below starting at location 0x45 from a RAM Window in Mikro C Pro debugger.

Which in binary would be:

10000001 10001100 11001100 11001101

Now if you are not extremely familiar with how to convert floating point numbers to binary and back, you might like to use this tool from Harald Schmidt which will do it for you.
According to the standard -4.4 in binary is

11000000 10001100 11001100 11001101 

and in Hex: 


The first thing to notice (quite obviously really) is that the last two bytes are the same in both representations CC CD hence we don't need to touch them, great! Now let's see what we would need to do in order to "adjust" the other two bytes to match the IEEE754 standard.
The green digit needs to "fly" in front of the blues which in turn need to move down the bench and the reds do not move at all! This is it.

Now let's see how could this be done in Mikro C code.
Assume we have declared

float number = -4.4;

we would need to be able to access each of the four bytes representing the number so to be able to manipulate them. There are essentially two ways I can think of:
Use the built in routines Lo, Hi, Higher, Highest or use a pointer "creatively".
I like the second better. 

For option 1 you need to remember to

#include "built_in.h"

then declare four byte-size variables

unsigned char one, two, three, four;

after which you can distribute the 4 bytes of floating point number. Three and four will not be needed for this example but it might be handy to have them for example depending on how we intend to get the floating number to the PC (e.g over a serial line).

one =Lo(number); 0x81 0b10000001
two = Hi(number); 0x8C 0b10001100
three = Higher(number); 0xCC 0b11001100
four = Highest(number); 0xCD 0b11001101

Option 2 instead needs a pointer like

unsigned char *numberPoint = &number;

Now the compiler will warn "Suspicious pointer conversion", but doing so will allow us to "scan" the floating point bytes as in

one = *(numberPoint + 3); 0x81 0b10000001
two = *(numberPoint + 2); 0x8C 0b10001100
three = *(numberPoint + 1); 0xCC 0b11001100
four = *numberPoint; 0xCD 0b11001101

looking at the RAM window above, if we had defined the pointer as float *(numberPoint + 1) it would have returned the value BC at location 0x49. That is because 1 in this case is 1 size of floating point numbers, in fact 4 bytes! By declaring our pointer of a type char, which is stored in one byte, we gain the necessary granularity we need to move one byte at a time in the floating point binary representation.

All right, we haven't finished yet but we are nearly there. Now we need to do our flying and shifting of bits.
A really useful thing that you can do in C is that it can embed Assembler code in your program.
Now, whatever the CPU architecture. you will always have Assembler instructions for shifting, rotating or both shifting and rotating. They are very similar commands and essentially they tell the CPU to "move" all the bits to the right or to the left. What happens to the leftmost bit when rotating to the left? It "moves" to a particular location called the carry flag (CF), if you then rotate to the right the carry flag gets back on the leftmost bit of the byte. This is what we need to know. If you really really want to know more, there is just about a ton of stuff on the Internet, just Google it.

So coming back to our bytes, we would need to rotate to the left (rlf) byte two, push the CF bit back into byte one by rotating to the right (rrf) and finally rrf the new CF to byte two. That's it!

rlf two 10001100 CF=1 two=0001100x (the x because it does not matter what was in the CF)
rrf one 10000001 CF=1 one=11000000
rrf two 0001100x CF=x two=10001100

this is how you write it in Assembler in your Mikro C editor

asm {
          bsf STATUS, C
          rlf _two, 1
          rrf _one, 1
          rrf _two, 1

so now we have our 11000000 10001100 11001100 11001101 hurrah!  

I hope you found this useful, it turns out I did not need to do this for the project I was working on and that generally there are better ways to get values that are represented with floating point numbers to a PC but maybe this is for another post.  

Wednesday, January 25

EasyPIC6 configuration backup

If you are anything like me you might want to work on several projects at the same time with your EasyPIC. I needed to come up with a "snapshot" of the board configuration an thought MS Visio could come in handy.
For the time being there is only an EasyPIC6 version but I should shortly make an EasyPIC v7 one!

Some tips on how to use it:

Switches: Each of the switch is a separate Visio element made so that if you flip it the yellow and the white part will swap places. Simply select one and use the shortcut CTRL + j for the vertical oriented switches and CTRL + h for the horizontal ones.

Jumpers: The best method is to move jumpers bu simply selecting them and move them with the arrow keys.
Port Connectors: I have added 10 connector points to them so that it makes it easier to attach something to them, maybe a simple circuit.

Microchips: Just delete or move away the ones that are not needed :)