Posts

Showing posts from May, 2016

Advanced PIC18 Projects—SD Card Projects:Using the Card Filing System

Image
PROJECT 7.3—Using the Card Filing System The hardware of this project is the same as for Project 7.1 (i.e., as shown in Figure 7.8). In this project, a file called MYFILE55.TXT is created on the SD card. String “This is MYFILE.TXT” is written to the file initially. Then the string “This is the added data.. .” is appended to the file. The program then reads the contents of the file and sends the string “This is MYFILE.TXT. This is the added data.. .” to the UART, enabling the data to be displayed on the PC screen when HyperTerminal is run. The program listing of the project is given in Figure 7.12 (program SD3.C). At the beginning of the program the UART is initialized to 2400 baud. Then the SPI bus and the FAT file system are initialized as required by the library. The program then creates file MYFILE55.TXT by calling library function Mmc_Fat_Assign with the arguments as the filename and the creation flag 0x80, which tells the function to create a new file if the file doe...

Advanced PIC18 Projects—CAN Bus Projects:PIC18F258 Microcontroller

Image
PIC18F258 Microcontroller Later in this chapter the PIC18F258 microcontroller is used in a CAN bus–based project. This section describes this microcontroller and its operating principles with respect to its built-in CAN bus. The principles here are in general applicable to other PIC microcontrollers with CAN modules. The PIC18F258 is a high performance 8-bit microcontroller with integrated CAN module. The device has the following features: • 32K flash program memory • 1536 bytes RAM data memory • 256 bytes EEPROM memory • 22 I/O ports • 5-channel 10-bit A/D converters • Three timers/counters • Three external interrupt pins • High-current (25mA) sink/source • Capture/compare/PWM module • SPI/I2C module • CAN 2.0A/B module • Power-on reset and power-on timer • Watchdog timer • Priority level interrupts • DC to 40MHz clock input • 8 x 8 hardware multiplier • Wide operating voltage (2.0V to 5.5V) • Power-saving sleep mode The features of the PIC18F...

Simple PIC18 Projects

In this chapter we will look at the design of simple PIC18 microcontroller-based projects, with the idea of becoming familiar with basic interfacing techniques and learning how to use the various microcontroller peripheral registers. We will look at the design of projects using LEDs, push-button switches, keyboards, LED arrays, sound devices, and so on, and we will develop programs in C language using the mikroC compiler. The hardware is designed on a low-cost breadboard, but development kits such as BIGPIC4 can be used for these projects. We will start with very simple projects and proceed to more complex ones. It is recommended that the reader moves through the projects in their given order. The following are provided for each project: • Description of the program • Description of the hardware • Circuit diagram • Algorithm description (in PDL) • Program listing • Suggestions for further development The program’s algorithm can be described in a variety of g...