Turn-key PCB assembly services in prototype quantities or low-volume to mid-volume production runs

PHP vs Python for Web Development

PHP is undoubtedly the most popular server-side language used for web development. Over 80% of websites are developed in PHP, including popular platforms, such as Facebook, Wikipedia or Tumblr. However, recently there has been a notable popularity revival of another backend language, Python, which is also used by the big tech fish, such as Google, YouTube or Dropbox. If you’re looking to build web applications, you might wonder which language might be a better option for you. In order to decide which of these two languages can be more suitable for your project, it is worth discussing what they both have to offer. Why Choose PHP? PHP is an open source server-side language and has a wide community of users, which gives PHP developers the possibility to join great support system for PHP coders and gain easy access to references, guidelines, new resources and updates, as well as extensions libraries. Bugs are also fixed at an impressive speed. PHP also offers a variety of frameworks, Symfony and Laravel being the most popular. The PHP’s syntax is similar to the C and C++ languages, two popular programming languages, so it allows for an easy, smooth transition for developers familiar with either…

Continue reading

Program Flow In Embedded C

Program Flow and control is a control method of your program. For example Loop constructions control repeated execution of repeated program segments where control is taken by control parameter. In this article we will go through if/else switch/case statements and loop sentences like while, do while, for. While statement As I mentioned three looping sentences available in C language one of them is While sentence. Lets take an example: #include <stdio.h> int main(void) { int guess, i; i=1; guess=5; while (guess!=i) { i=guess; guess=(i+(10000/i))/2; } printf(“Square root of 10000 is %d\n”, guess); return 0; } While(guess!=i) invokes looping operation. This causes statement to be executed repeatedly at the beginning the condition guess!=i is checked. As long the argument is TRUE the while sentence will be continued continuously. When guess becomes equal to i while statement will be skipped. I am not going to deep in to it as there are tons of information about basic C.

Continue reading

Why C instead ASM

ASM is a specific language also referred as low level programming language. It is a mnemonics to a machine codes. It usually takes long time to develop embedded programs in ASM language. Today even modern 8 bit microcontrollers are powerful and complex as they were long time ago. The program memory of tiny chips are reaching megabytes, they pack lots of peripherals and interfaces. Hardware code is becoming more complex, functionality grows up. This is one of the main reasons of using higher level programming languages like C. By using C language you do not have to go into details how processor works at hardware level. You don’t have to think about hardware logic how bytes are shifted between registers. It is better to leave t Another advantage of C language against ASM is portability. If you work with embedded system architecture and decide to move to other, and your previous program were written in ASM, then you are stuck to rewriting this code from scratch. Using C written programs you can re-compile code for different microcontrollers without significant modifications of code. This way your new project code upgrade becomes easy task. C or other high level programming language makes…

Continue reading

Example of enumeration c in microcontroller programming

Enumeration allows defining a user data types in C language. For this purpose a #define pre-processor is used which allows describing a set of constants. They allow reading and understanding program code much easier as you may define human readable types. For instance, using pre-processor we can define a simple numbers to be as follows: #define zero 0#define one 1#define two 3 Define is powerful tool for doing many different definitions in pre-processing stage of source code, but in C language there is an alternative way of defining a user data types –  enumerating using keyword enum: enum (zero=0,one, two); //zero=0, one=1; two=2 By default, enumeration assigns values from zero and up. You can use enumeration of new types as in following example: int n;enum (zero=0,one, two);n=one; //n=1 Also you can use enum  to assign special characters to meaningful words like this: enum escapes { BELL = ‘\a’, BACKSPACE = ‘\b’, HTAB = ‘\t’,RETURN = ‘\r’, NEWLINE = ‘\n’, VTAB = ‘\v’ };or enum boolean { FALSE = 0, TRUE }; An advantage of enum over #define is that it has scope, what means that the variable (just like any other) is only visible within the block it was declared.…

Continue reading

AVR GCC Structures

Basically Structures are nothing more than collection of variables so called members. Structures allows to reference all members by single name. Variables within a structure doesn’t have to be the same type. General structure declaration: struct structure_tag_name{ type member1; type member2; … type memberX }; or struct structure_tag_name{ type member1; type member2; … type memberX } structure_variable_name; in second example we declared the variable name. Otherwise variables can be declared this way: struct structure_tag_name var1, var2,var3[3]; Members of structure can be accessed by using member operator (.). The member operator connects the member name to the structure. Lets take an example: struct position{ int x; int y; }robot; we can set robot position by using following sentence: robot.x=10; robot.y=15; or simply robot={10,15}; Structures can be nested: struct status{ int power; struct position coordinates; } robotstatus; to access robot x coordinate we have to write: x=robotstatus.coordinates.x; Actions can be taken with structures: Copy; Assign; Take its address with &; Access members. Of course you can treat a structure like a variable type. So you can create an array of structures like: struct status{ int power; struct position coordinates; } robotstatus[100]; Accessing 15th robot power would be like this: pow=robotstatus[15].power;

Continue reading

Accessing AVR microcontroller ports with AVR GCC

All AVR ports have Read-modify-write functionality when used for general I/O functionality. The direction of each separate port pin can be changed. Each pin buffer has the symmetric capability with the ability to drive and sink source. The pin driver is strong enough to drive LED directly, but it is not recommended to drive even small loads without using proper driver circuit such as transistors. All port pins have internal selectable pull-up resistors. And finally, all pins have protection diodes to both VCC and GND rails. Each port of AVR consists of three registers DDRx, PORTx and PINx (where x means port letter). DDRx register selects the direction of port pins. If logic one is written to DDRx then the port is configured to be as output. Zero means that the port is configured as an input. If DDRx is written zero and PORTx is written logic “1” then the port is configured as input with an internal pull-up resistor. Otherwise, if PORTx is written to zero, then the port is configured as input but pins are set to tri-state and you might need to connect external pull-up resistors. If PORTx is written to logic “1” and DDRx is set…

Continue reading

Why Using Ruby on Rails

Nowadays many big and small companies prefer using Ruby on Rails when creating applications that are to be delivered on the web. It is not surprising, as Ruby on Rails offers lots of advantages over other web development frameworks. Lets have a closer look at the benefits of Ruby on Rails or Ruby, as it is usually called. The main advantage of this framework is that it makes the life of a web developer easier, by allowing writing less code, which is achievable due to a leaner code base. Ruby on Rails is very easy to use. Beside, it gives speed and flexibility that no other scripting language or framework can give. Creating websites with Ruby on Rails is a lot faster and easier than with other web developing solutions. Generally, to develop and launch a website, developer needs about twelve weeks. While using Ruby on Rails, a web developers needs six weeks to complete a similar project. Modular design of Ruby on Rails allows reusing earlier created elements, rather than creating new ones. Making changes and adjustments is also a lot easier if a site is created with Ruby on Rails.

Continue reading