Friday, April 5, 2013

Simple PIC Programmer for less than $1

PIC Programming requires a programmer as a hardware interface between the Computer and the Microcontroller. There's a variety of programmers such as Pickit 2 , 3 offered by microchip , other USB programmers..
But why getting anyone of these programmers while you still can make your own programmer for less than $1 and in no time.

Now this is my own version of the programmer i made using a few resistors and diodes:


Desktop Preview:
The programmer circuit and project is all here http://www.instructables.com/id/Simple-JDM-PIC-Programmer/
Note that: this programmer has been tested and gave a very great results with high speed programming.
Monta Ghanmy

Saturday, March 16, 2013

L293D DC Motor Driver : Quick Tutorial

DC Motor interfacing directly to microcontroller is not very practical specially that this may damage the microcontroller or it's just won't work because of the low voltage that it provides.

A good solution is to use an interface between our DC motor and the microcontroller: In our case we'll be dealing with the L293D IC from STmicroelectronics. This circuit offers the ability to control 2 DC motors in both clockwise and counter clockwise direction with a maximum voltage of 12V.

Simple Circuit:




How it works:

The integrated circuit got 4 input pins , each 2 are used to give the direction of the rotaion of the motor or whether it is off.
The VSS pin is for powering the IC with 5V , the VS is for power that goes directly to the motors and which can be in a range of 12V.
If we want for example to turn on a motor , it's enough to set a first input high and the other one low or the opposite (IN1 High , IN2 Low / IN1 Low, IN2 High) and the same as for the second motor .
Now if you want to turn off the motor all what you need is to set both of the inputs low or high in the same time. (IN1 High, IN2 High / IN1 Low, IN2 Low) .



Electronic samples : free resources for your projects!

Lots of microcontroller and electronic manufacturers offers some of their products for free for their customers.
It's called samples , and it differs from a manufacturer to another. They basically want to encourage and provide you with some free resources to finish your project and make a commercial product out of it.
You can get ICs , LEDs, motors, microcontrollers, developement boards..

To get samples you need to apply for some rules:

-You should have member with company and have an account on their website.
-You should give a brief and convincing description about your project and it's utility.
-You should not abuse asking for samples.
Links to manufacturers that offers free samples:

-Microchip
-Atmel
-Texas Instruments
-STmicroelectronics
-Freescale


Similar articles: http://www.instructables.com/id/Free_Electronic_Samples
Monta Ghanmy

Sunday, April 15, 2012

Cool LED flasher for beginners!!

So you do already have a programmer and a pic microcontroller, but you don't have a project to work on. Here we start with a simple thing for beginners : LEDs. It's a very simple method to output a signal from a pic , and it would be great for your first project.
So what you will need:
-a pic microcontroller (i used PIC16F628 here)
-a 12k resistor
-2 resistors of 1k
-2 LEDs
-a bush button .
-some wires.
The circuit diagram:



Now the program(led_test.asm):

;************************************************************ 
; Processor: PIC16F628 at 4 MHz using internal RC oscillator 
; Function:  Flash a 2LEDs connected to RA2 and RA3 
; Author:    PIC DIY's
; Website:   http://www.pic-diys.blogspot.com 
;************************************************************ 


        LIST P=16F628, R=DEC    ; Use the PIC16F628 and decimal system 


        #include "P16F628.INC"  ; Include header file 


        __config  _INTRC_OSC_NOCLKOUT & _LVP_OFF & _WDT_OFF & _PWRTE_ON & _BODEN_ON 


        CBLOCK 0x20             ; Declare variable addresses starting at 0x20
          Loop1,Loop2 
        ENDC 

; ----------- 
; INITIALIZE 
; ----------- 

        ORG    0x000           ; Program starts at 0x000 

        CLRF   PORTA           ; Initialize port A 

        CLRF   PORTB           ; Initialize port B 

        BSF    STATUS,RP0      ; RAM bank 1 


        CLRF   TRISA           ; All pins port A output 

        CLRF   TRISB           ; All pins port B output 


        BCF    STATUS,RP0      ; RAM bank 0 

; ------------------------ 
; FUNCTION OF PORT A PINS 
; ------------------------ 

        MOVLW    7 
        MOVWF    CMCON         ; Comparators off, all pins digital I/O 

; ---------- 
; MAIN LOOP 
; ---------- 

Main    BSF     PORTA,2        ; Turn on LED connected to RA2 
        CALL    dilay
        BCF     PORTA,2        ; Turn off LED connected to RA2 
        CALL    dilay
        BSF    PORTA,2         ;Turn on LED connected to RA2
        CALL    dilay
        BCF    PORTA,2         ;Turn off LED connected to RA2
        CALL    delay
        BSF    PORTA,3         ;Turn on LED connected to RA3
        CALL    delay
        BCF    PORTA,3         ;Turn off LED connected to RA3
        CALL    dilay
        GOTO    Main 

; --------------- 
; DELAY 120 MSEC 
; --------------- 

delay   MOVLW   120 
        MOVWF   Loop1

; --------------- 
; DiLAY 80 MSEC 
; --------------- 

dilay   MOVLW   80 
        MOVWF   Loop1 
Outer   MOVLW   200 
        MOVWF   Loop2 
Inner   NOP 
        NOP 
        DECFSZ  Loop2,F 
        GOTO    Inner          ; Inner loop = 5 usec. 
        DECFSZ  Loop1,F 
        GOTO    Outer 
        RETURN 


        END
You can use the MPASM from Microchip to assemble the programme . It's easy and nice to work with.
After assembling the programme , burn it on your pic (PIC 16F628 used in this project). You can have a look on our simple pic programmer tutorail here.
Remarque: You can always use an usb cable to have a quick 5V. the red wire is the positive(5v) and the black one is the ground (-).
I guess that this is all what i got , any question you can comment on. You can follow my posts with e-mail.
Thank's for your attention guys!


Monta Ghanmy