Advanced PIC18 Projects—CAN Bus Projects:PIC18F258 Microcontroller

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 […]
Continue reading…

 

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 […]
Continue reading…

 

Multi-Tasking and Real-Time Operating Systems:Voltmeter with RS232 Serial Output

PROJECT 10.3—Voltmeter with RS232 Serial Output In this RTOS project, which is more complex than the preceding ones, the voltage is read using an A/D converter and then sent over the serial port to a PC. The project consists of three tasks: Live, Get_voltage, and To_RS232. • Task Live runs every 200ms and flashes an […]
Continue reading…

 

Multi-Tasking and Real-Time Operating Systems:Random Number Generator

PROJECT 10.2—Random Number Generator In this slightly more complex RTOS project, a random number between 0 and 255 is generated. Eight LEDs are connected to PORTB of a PIC18F452 microcontroller. In addition, a push-button switch is connected to bit 0 of PORTD (RD0), and an LED is connected to bit 7 of PORTD (RD7). Three […]
Continue reading…

 

Multi-Tasking and Real-Time Operating Systems:CCS PIC C Compiler RTOS

CCS PIC C Compiler RTOS The CCS PIC C compiler is one of the popular C compilers for the PIC16 and PIC18 series of microcontrollers. In addition to their PIC compilers, Customer Computer Services offers PIC in-circuit emulators, simulators, microcontroller programmers, and various development kits. The syntax of the CCS C language is slightly different […]
Continue reading…

 

Multi-Tasking and Real-Time Operating Systems:The Real-Time Operating System (RTOS)

The Real-Time Operating System (RTOS) Real-time operating systems are built around a multi-tasking kernel which controls the allocation of time slices to tasks. A time slice is the period of time a given task has for execution before it is stopped and replaced by another task. This process, also known as context switching, repeats continuously. […]
Continue reading…

 

Multi-Tasking and Real-Time Operating Systems:State Machines

State Machines State machines are simple constructs used to perform several activities, usually in a sequence. Many real-life systems fall into this category. For example, the operation of a washing machine or a dishwasher is easily described with a state machine construct. Perhaps the simplest method of implementing a state machine construct in C is […]
Continue reading…

 

Advanced PIC18 Projects—CAN Bus Projects:CAN Bus Programming

CAN Bus Programming To operate the PIC18F258 microcontroller on the CAN bus, perform the following steps: • Configure the CAN bus I/O port directions (RB2 and RB3) • Initialize the CAN module (CANInitialize) • Set the CAN module to CONFIG mode (CANSetOperationMode) • Set the mask registers (CANSetMask) • Set the filter registers (CANSetFilter) • […]
Continue reading…