SPI protocol has earned a solid role in embedded systems whether it is system on chip processors, both with higher end 32-bit processors such as those using ARM, MIC or Power PC and with other microcontrollers such as the AVR, PIC etc. These chips usually include SPI controllers capable of running in either master or slave mode. In-system programmable AVR controllers can be programmed using an SPI interface.Chip or FPGA based designs sometimes use SPI to communicate.So, SPI is a common technology used nowadays for communication with peripheral devices where we want to transfer data speedily and with in real time constraints. There are many serial interfaces right from Morse code telegraphy, RS232, USB, Fire wire, Ethernet and many more. Each serial interface offers advantages or disadvantages for many designs,depending on criteria such as needed data rate, space availability, and noise considerations.
Simple analog communication over the telephone wires to the typical USB cables for data exchange, we surely have come a long way in the field of communication. RS232 was the first milestone reached in this journey. It was a standard for electromechanical typewriters and modems for digital data exchange introduced in 1962 by the Radio Sector of EIA. It made the data exchange more reliable over analog channel. The standard defined voltage levels that made it immune to noise disturbances and reduced the error in data exchange.As the technology was growing many electronic devices were being developed during this time like computers, printers, test instrument etc. There came a time where manufacturers felt the need to exchange information between these electronic devices. For example data exchange between a computer and a printer or two computers. But there was no standard or method to accomplish this task. RS232 was the only available standard at the time which was used for data exchange. So, they thought of adopting this standard in electronic devices for digital data exchange.
Processing is a Java based open source programming language and IDE (Integrated development environment) used for writing and running programs on a computer. The main advantage of Processing is that it allows people with less or no knowledge on programming also to learn programming easily and become experts. Processing accomplishes this by providing numerous examples and tutorials pre-loaded in the software itself. What we will use Processing is for letting our development board (Arduino/ ATmega8 Dev. Board/ ATmega16 dev. board) to communicate with the PC/ Laptop running Processing. Well basically it starts a serial communication with the device connected at the COM port mentioned by us. Then it continuously sends the character “H” (if the mouse pointer is on the rectangle) or “L” (if the mouse pointer is moved away from the rectangle) to the device. The software and hardware requirements of this project are: PC/ Laptop running Windows 7/XP, Java Development Kit 7, Processing 2.0 or above.
Most modern instruments such as oscilloscopes, spectrum analyzers, function generators, and even some power supplies support communication with a computer through a parallel port or a serial port. This communication provides an easy and accurate way to control an experiment and collect and process data. Here we will be more focused on serial communication. In serial communication Signal can have two states 0 or 1. The signal state is determined based on voltage levels on the signal line. +5v to +15v implies state 0(low) and –5v to –15v implies signal state of 1(High). This entire project is divided in to 2 parts, the first part demonstrates the software implementation of the serial communication between MATLAB and the PC and the second part demonstrates the hardware implementation of serial communication between the MATLAB and WSN-AK development kit (ATMEGA324PA).
Both, Parallel and Serial modes of communication have certain advantages and disadvantages over one another. The serial communication is a preferred option due [[wysiwyg_imageupload::]]to its ability of long distance communication with error detection capability. The microcontrollers consist of an inbuilt hardware unit known as USART (Universal Synchronous Asynchronous Reception and Transmission) to facilitate serial transfer of data. Before starting USART, some general terms related to communication need to be understood. These terms are explained below.Asynchronous Communication: In this type of communication, both Transmitter (Tx) and Receiver (Rx) work on different clocks which means that they are not synchronized. Start and Stop bits are also sent with each Data byte to identify the data. Synchronous Communication: In this type of communication, both Tx and Rx are synchronized with the same clock and no Start or Stop bits are used.Full-duplex Communication: When either of the devices can send and receive data at the same instant, they are said to have full-duplex communication.
The previous article explains serial communication using 8-bit data transfer. AVR microcontroller also supports serial data transfer with frame size of 5, 6, 7 and 9 [[wysiwyg_imageupload::]]data bits. The size of data frame can be adjusted according to application. For example, consider a system that needs to transmit only ASCII codes as data. In this case data frame size of 7-bits is sufficient because data length of ASCII code is equal to 7-bit. This will makes system more efficient by saving time of one clock period in each data frame transmission. This article explains serial transfer of data with different frame size. A test program is written for 6-bit data communication between Microcontroller and PC. In this experiment the input is taken from the user through a keyboard. The corresponding data is sent to microcontroller via PC’s COM port. The microcontroller receives data and returns it again to PC’s COM port. The HyperTerminal is used to configure COM port to make it compatible for this experiment.
Communication between two entities is important for the information flow to take place. In general the information transport system can be parallel in which the [[wysiwyg_imageupload::]]complete byte of data is sent at a time, with each bit having a separate dedicated line or it can be serial where only one communication line is available which is shared by all the bits sequentially. The pros and cons of these two systems are equivalent and selection between the two depends on the application.Data can be exchanged using parallel or serial techniques. Setup for parallel data transfer is not cost effective but is a very fast method of communication. Serial communication is cost effective because it requires only a single line of connection but on the other hand is a slow process in comparison to parallel communication. This article explains serial communication of AVR microcontroller (ATmega16) with PC. The data is transmitted from the controller using RS232 standard and displayed on the PC using Hyper Terminal.