TableView + JSON Tutorial – Part II

Integrating UITableView and UINavigationController

To add the UINavigationController to the Apps, modify the AppDelegate.h as follow

 

Then, in the AppDelegate.m

 

 

Run your project and you should get the output as follow

 

_______________________________________________________________________
The completed Apps can be downloaded from https://itunes.apple.com/us/app/malaysia-car-plate/id504558521?mt=8.

 

TableView + JSON Tutorial – Part I

Create New ViewController Project

We will start with creating a blank project. From the XCode, choose to Create New Project. Then inside the template selection pane, choose to create a Single View Application. Click Next to continue.

 

 

The next pane is for you to enter your Project Name, Company Identifier, and the Device Families. Since we are creating the iPhone Apps, choose the iPhone from the drop down menu.

 

 

After that, you will be prompt to select a folder to save your project.

 

 

Once your click the Create button, XCode will create the Single View Application template for you. If you click the Run button or ⌘R to test your apps for the first time.

 

 

_______________________________________________________________________
The completed Apps can be downloaded from https://itunes.apple.com/us/app/malaysia-car-plate/id504558521?mt=8.

 

Interrupt for XC8

Interrupt is an important element in PIC microcontroller. The interrupt mechanism provides the ability to preempted the processor from running the main program and switch its resources to the peripherals that introduce the interrupt.

The flag is the signature for the microcontroller to identify which peripheral is calling the interrupt. In PIC microcontroller, the name of the flag for each peripheral ended with the word IF. For example: Interrupt flag for Timer 0 ( TMR0IF), Interrupt flag for INT1 (INT1IF) …

The portion of the codes that the processor going to execute during interrupt is called Interrupt Service Routine (ISR). It is the best practice to keep the ISR as short as possible.

It couldn’t be simpler for programming the interrupt using XC8 compiler

“Hello World” for XC8

In this tutorial we are going to turn on the LEDs connected to PORTB in the µStack Bootloader Board.

CodeOffset in MPLAB® X

Typically, the Resset and Interrupt High and Interrupt Low Vector is located at address, 0×0000, 0×0008, and 0×0018, respectively. However, when a bootloader is burned into the microcontroller, these address spaces have been consumed by the firmware (Microchip USB Bootloader Firmware is located in the memory location from 0×000 till 0x0FFF). Therefore, we have to remapped the memory location manually to acknowledge the microcontroller recognizing the memory layout.

Remapping the memory location is much easier using MPLAB® X and XC8 Compiler.

Goto File > Project Properties

BootloaderOption-01

Select the XC8 Linker, then from the choose Additional Options from the drop down menu.

BootloaderOption-02

In the CodeOffset Textbox, type 0×1000 (The bootloader is located from 0×0000 till 0x0FFF, therefore our program should start at 0×1000)

BootloaderOption-03

Click Apply or OK button to save the configuration.

 

Adding Files into Project

The files for a MPLAB® X Project is organized in various folders. Typically, we are working on either the Header Files (*.h) and the Source Files (*.c).

To add a new file into the Project, Right Click on the corresponding folder, then choose the file that you want to create.

CreateProject-07

In the New File windows, enter the File Name and make sure the correct Extension is selected.
CreateProject-08

 

Click Finish to create the new file.
CreateProject-09

Creating New Project

To start a new project, click File > New Project

CreateProject-01

Select the Microchip Embedded, and Standalone Project from the list

CreateProject-02

Select the Devices used in the project accordingly.

CreateProject-03

Select the Tool/Programmer available. In case of bootloader board, choose either as it doesn’t matter after all.

CreateProject-04

Select the Compiler used. If XC8 is not in the list, either the XC8 is not properly installed.

CreateProject-05

Lastly, key-in a suitable Project Name and Browse for the folder location to store in the computer.

CreateProject-06

Done.

 

Installation Error: XC8 Compiler

A warning is prompted when installing XC8 v1.12 to Windows 7 (64-bit), although the installation was completed after you click the OK button.
According to Microsoft, this has something to do with registering the dll on a 64-bit system (http://support.microsoft.com/kb/282747).

Resolution #1:
Register is dll manually as suggested by Microsoft.

If you still having problem compiling the code using XC8, try remove and link again the XC8 compiler to MPLAB® X.

Resolution #2: 
- From the MPLAB® X Menu, goto Tools > Options.
- Go to the Embedded Tab in the Options Window, Remove the XC8 (v1.12) from the Toolchain. Then click the Scan for Build Tools button at the bottom.