Archive for Student research

PIC18f26j11 Pan/tilt control demonstration.

The Pic18f26j11 works suing the configuration bits shown in earlier post, using the internal oscillator and C18 compiler from MPLAB IDE 8.90, which aloud us to write in C lenguage.
The pic used for this test was given by university lecture Panos Loakin the pin configuration is:

  • PORTA;
  1. Unuse in this test but all set to be outputs
  • PORTB;
  1. All outputs for testing, in this board we only use 3 outputs.
  2. RB7; Green LED.
  3. RB6; Green LED.
  4. RB5; Green LED.
  • PORTC;
  1. RC4 &RC5 not use at this point.
  2. RC7; RX1 Connected to R232 TX
  3. RC6; TX1 Connected to R232 RX
  4. RC3; Green LED.
  5. RC2; Green LED.
  6. RC1; Red LED.
  7. RC0; Green LED.

The board is power it with a 9v battery  and programmed with a PICkit two also provided by university.

Provided by UEL

PIC18F26J11 Provided by UEL

 

In this image you can see the pic18f26j11 in a PCB board and with the connector for the PIckit2 this board was provided by my tutor.

There is also the 9v battery connector ground connection coming from the VSS pin 8 of the pic18f26j11. The image below show the pic18f26j11 connected to the R232 and using a 9v battery.

100_0097

Pic18f26j11 to USB TTL-232R-3

The board in the image above show the pic18 working with different combination of LED’s. Each combination for a command key from the keyboard. The interface in vb.net use either 4 arrow keys from a keyboard or the numpad using up to 8 keys. It should also work with mousepad or a normal mouse but at this point this has not been implemented in the program.

The video demosntrate the funcionality of the chip uisng the control interface.

PIC18F26J11 Configuration bits

The configuration bits are important part to set the project efficiently and not have problems when uploading it to the microcontroller. MPLAB help menu contain a topic for this specifications which contain each pic from all their families will each individual configurations settings and commands.

The Pic18 contain all this introductions to set its configurations bits. The configuration is done by using the pragma command. Which microchip defines as:

Pragma; A directive that has meaning to a specific compiler…The ANSI C standard provides each C implementation a method for defining unique constructs, as required by the architecture of the target processor. This is done using the #pragma directive. (2005, Microchip)

Below you have an example of all the configuration bits from the pic18f26j11.

/** C O N F I G U R A T I O N B I T S ******************************/#pragma config WDTEN = OFF //Watchdor timer OFF

#pragma config STVREN =OFF //Stack overflow/Underflow Rest
#pragma config XINST = OFF //Extended Instruction Set OFF
#pragma config DEBUG = OFF //Background DEbug OFF
#pragma config CP0 = OFF //Progam memory is not code-protected
#pragma config OSC = INTOSC //Internal Oscilator
#pragma config T1DIG = OFF //Secondary Oscillator clock source may not be selected
#pragma config LPT1OSC = OFF //High power operation
#pragma config FCMEN = OFF //Fail-Safe clock monitor Off
#pragma config IESO = OFF //Internal External Oscillator Switch Over mode
#pragma config WDTPS = 1 //Watchdog Postcaler = 1.1 in this case
#pragma config DSWDTOSC = INTOSCREF //RTCC clock select, RTCC uses INTRC
#pragma config DSBOREN = OFF //Deep Sleep BOR; Dissable
#pragma config DSWDTEN = OFF //Deep Sleep Watchdog Timer; Disable
#pragma config DSWDTPS = 2 //Deep Sleep Watchdog Postcaler; 1:2(2.1ms) 
#pragma config IOL1WAY = OFF //The IOLOCK bit (PPSCON<0>) 
#pragma config MSSP7B_EN = MSK7 //5 or in this case 7 bit address masking mode
#pragma config WPFP = PAGE_0 //Write protect program flash page 0 
#pragma config WPEND = PAGE_0 //Page 0 throught WPFP<0:5>erase/write protected                    
#pragma config WPCFG = OFF //Configutation words page not erase/write protected
#pragma config WPDIS = OFF //WPFP<5:0>/WPEND region ignored*/

The following code was used for the arm-robot configuration as it was assumed that the rest will be set as default.

#pragma config OSC = INTOSC
#pragma config WDTEN = OFF, XINST = OFF
#pragma config IOL1WAY = ON

 

PIC18F26j11 ASM to C18

The Pic18f26j11 was chosen by a lecture as a model for micro-controllers programming using assemble language.  The Pic18f26j11 was used for the past year and a half in various small projects; semaphore and password door control.

It was decided to begin the Robot-arm by using the door control project as a beginning structure point. The problem this project had a few faults the project was finish in a week time since the pic18 was given really late, students had to share resources for this project.

Table for codec to control motors………………… to be added

The main problem was that the project was never really finished, when approaching the deadline it had to be completed to a working solution. The result product did work within his minimum requirements.

  • It was not one hundred percent stable; it will stop working it user press the code panel many times to fast.
  • The PIC18 did not really interpreted the code received for OPEN/CLOSE gate; One of the options was using indirect addressing and a possible further development into this project. The way to read OPEN instruction was created by sending two line of code save into an indirect addresses, the CLOSE gate will only send one line of code. The project used a counter to count how many indirect addresses where save and then OPEN/CLOSE the gate, in this case and LED green for open and red for close/wrong code will demonstrated that the PIC18 worked.

Since the arm-robot project required to understand the different instructions received from the computer, the issue refer in the gate system  project needed to be resolve. The assembly programming has demonstrated its advantages since you get to understand how the micro-controller works, having this knowledge and a base of C programming the best solution was to use C18 compiler and its libraries.

A library is a collection of functions grouped for reference and ease of linking…The processor-specific library files contain definitions that may vary across individual members of the PIC18 family. This includes all of the peripheral routines and the Special Function Register (SFR) definitions. (Microchip, 2005)

C18 is a Microchip compiler to program in C language for MPLAB IDE software. The advantage of C18 is that you can find a vast number of examples in their website but further understanding in the use of its libraries is required.

The disadvantages of the Pic18f26j11 is that there are not examples which particular use this micro-controller and some mistakes can be easily made when using other pic18 examples as reference.

Solidworks first design.

This is the first finished design created in Solidworks, which is a cad software provided by university.

robot1

First Robot Design using Solidworks

 

I decided to use the Planetary Gearbox Stepper: 42BYGH40(M)-160-4A NEMA 17 Bipolar 99.55:1. After looking in libraries for a design of those for cad software solidworks and since I am still developing my skills in Solidworks  the decision was created my own, it will be required a cad software to view or manipulate this file (Solidworks eDrawings free for viewing this file).

The dimensions of the motors were taken from the mechanical drawing from Active robots websiteThe motor was intended for demonstration purposes, after realizing their price with our budget been £50; it was required to find another solution.