Showing posts with label microchip. Show all posts
Showing posts with label microchip. Show all posts

Saturday, April 28, 2012

Installing MPLAB X IDE on Linux




MPLABX Integrated Development Environment (IDE) is a free, integrated toolset for the development of embedded applications on Microchip's PIC and dsPIC microcontrollers.

MPLAB X is not a new version of the current MPLAB IDE v8 framework but is instead based on Oracle's open-source NetBeans platform. In addition to its predecessor's functionalities and compatibility with Microchip's existing development tools, the new IDE utilises many NetBeans features allowing for user-interface improvements and performance upgrades[1]

Presumption

System: Fedora Core 16 - x64

Downloading


download IDE and your favorite compiler
http://ww1.microchip.com/downloads/mplab/X/index.html

OR using wget
wget http://ww1.microchip.com/downloads/mplab/X/mplabx-ide-v1.10-linux-installer.run # mplab X IDE
wget http://ww1.microchip.com/downloads/mplab/X/mplabc18-v3.40-linux-full-installer.run # C18 Compiler

Since IDE written in Java we need java run time if you already them installed go to next step if you dont, following the link below

http://www.java.com/en/download/help/linux_install.xml

Installing

$ chmod 755 mplabx-ide-v1.10-linux-installer.run
$ chmod 755 mplabc18-v3.40-linux-full-installer.run

$ ./mplabx-ide-v1.10-linux-installer.run
$ ./mplabc18-v3.40-linux-full-installer.run

$ reboot

Configuring

now we should configure the IDE before we start compiling codes

Run mplabx

$ mplab_ide

from "run" menu --> Set Project Configuration --> customize...

In left-most click on mcc18 then in right-most scroll down and double-click on "Include directories", a new dialog will be opened,double-click on it and change the default path for header file directories to "/opt/microchip/mplabc18/v3.40/h".

Compiler Configuration

Click ok.

In left-most click on MPLINK then in right-most scroll down and double-click on 'Library directories',a new dialog will be opened, double-click on it and change the default path for header file directories to "/opt/microchip/mplabc18/v3.40/lib/".

Linker Configuration


Click ok.

Apply then ok.

Case-Sensitive Problem


i have notice a small problem when i tried to compile an old project. the error was "Error - could not find file 'LibName.lib'.

this problem happen because lib names are written as high-letter on hard disk whereas MPLINK looking for low-letter names. eg ( on disk p18F4550.lib and MPLINK looking for p18f4550.lib).

to solve this problem we will make all of them low-letter


$ su -  # be root
# cd /opt/microchip/mplabc18/v3.40/lib
# for f in `find`; do mv -v $f `echo $f | tr '[A-Z]' '[a-z]'`; done


Known Bug in Oracle Java JDK 1.6.x



Bug Description

incorrect mouse pointer position on java menus when running the application
maximized under gnome-shell.

1. If I single-click a menu in the menu bar, the menu will flash
briefly and disappears (instead of staying opened).
2. If I click and hold on a menu in the menu bar, the menu stays
opened, but the selection is vertically displaced (I have to move the
mouse to the third menu item to select the first one, for example).
3. If I right-click to access a context-menu, the selection is
displaced as described in the previous case).


The problem is that when the window is maximized java was not updating the
 window position properly. If the window was at pixel (100,100) then it was
 maximized, AWT thinks that it is still at pixel (100,100) instead of close to
(0,0). This causes it to miscalculate mouse pointer positions relative to the
window. [2]

Solution for this bug

remove old packages
# yum remove java-1.6.0-openjdk-1.6.0.0-65.1.11.1.fc16.x86_64 java-1.6.0-openjdk-devel-1.6.0.0-65.1.11.1.fc16.x86_64

*this could be vary from system to another, to know yours
$ rpm -qa|grep java

install new packages
# yum install java-1.7.0-openjdk
# yum install java-1.7.0-openjdk-devel

Set default Java version to mplabx_ide
# cp  /opt/microchip/mplabx/mplab_ide/etc/mplab_ide.conf  /opt/microchip/mplabx/mplab_ide/etc/mplab_ide.conf.bk
# gedit /opt/microchip/mplabx/mplab_ide/etc/mplab_ide.conf

search for jdkhome="/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.3.x86_64/" and replace it with jdkhome="/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.3.x86_64/"

*this could be vary from system to another, to know yours
$ ls /usr/lib/jvm/

References

[1] http://en.wikipedia.org/wiki/MPLAB
[2] https://bugzilla.redhat.com/show_bug.cgi?id=698295

Wednesday, October 5, 2011

Temperature Controller

ABSTRACT

Measuring the temperature using a thermistor and ADC and take action when temperature  outside a certain range. the video below shows how does temperature change when I cover thermistor with my finger.

The data is sent through USB in order to test the system before implementation.

SUMMARY

Approach Type Quick-And-Dirty
Programming Language ANSI C
Processor PIC18F4550
Software Components/Libraries N/A
Compiler/Linker Microchip C18



Friday, July 15, 2011

Digital 8-Ways USB Joystick

ABSTRACT


This project meant to create full-features joystick, the project covers the hardware design and the firmware, as well as software to test the signals sent by the joystick.

The USB joystick in this project was created with 13 fire buttons (action buttons) and one directions controller which uses two coordinates X and Y. because of limitation of I/O ports, the Z coordinate was written in the software but it was not be implemented in the Hardware.

The communication between devices and a host controller uses USB 2.0 specification in Full-Speed mode as it was defined in Universal Serial Bus Implementers Forum [1]. The standard USB A plug was used in order to make the project more portable.

Joystick in Final Stage









Joystick firmware was written in ANSI C, and the joystick software tester was written in Microsoft Visual C# 2008. Also an external header files from microchip were used to establish safe USB connection [2].

The MPLAB version 8.60.00 [3], C18 compiler version v3.37.01 [4], SlimDX SDK version 11.43.00 [5], Visual Studio version 9.0.21022.8 [6] and Microsoft framework version 3.5 SP1 [7] were used to create and test the system.
The term joystick is used within this project to refer to gamepad or control pad since they are almost differ in the physical appearance.


 


SUMMARY



Approach Type Optimized
PL C# and ANSI C
Processor PIC18F4550
Libraries Microchip USB Framework
Compiler Microsoft C# Compiler, Microchip C18 Compiler

 

REFERENCES