Saturday, September 19, 2009

PIC16F84A Clock


This is a simple clock that uses PIC16F84A ucontroller,4050 CMOS, seven segment (common anode), and few other components.
Short the same pins of 7-segment (a with a, b with b and so on) and connect them with appropriate 4050 pin. Also make sure to invert D3 & D4 like this:

7-Segment CA pin out:





  • IC3 PIC61F84A
  • IC1 & IC2 Cmos 4050
  • Resistors, R1 - R3 10K ohm 0.25W
  • S1 - S2, Push Switches
  • Ceramic Capacitors,C1-C2 30pF
  • Q1 4 MHz Crystal
  • D1-D4 seven segment CA
Hex code:


Friday, September 11, 2009

Dual Power Supply

This schematics is of dual power supply, having voltage output 3,5,6,9,12,15 and -3,-5,-6,-9,-12,-15. LM 317 is adjustable 3-terminal positive voltage regulator and LM 337 is adjustable 3-terminal negative voltage regulator.
Switch S1 is for +ve and S2 is for -ve voltage respectively.

click on image to zoom

All diodes are 1N4007
R1, R3 270 ohm
R2 1K2 ohm
R4, R10 390 ohm
R5, R11 820 ohm
R6, R12 1K ohm
R7, R13 1K65 ohm
R8, R14 2K35 ohm
R9, R15 3K ohm
C5, C8 2200uF 25v electrolyte
C6, C7, C9, C10 22uF 25v electrolyte
C1-C4 0.1uF Ceramic
F1 0.5A fuse
S Switch
S1, S2 6-way rotary switch
T1 Center taped transformer 15-0-15v 220v

Friday, September 4, 2009

Parallel Port Interfacing

A parallel port is a type of socket found on personal computers for interfacing with various peripherals. It is also known as a printer port.
PC parallel port is 25 pin, D-shaped female connector in the back of the computer. Not all 25 are needed always. Usually you can easily do with only 8 output pins (data lines) and signal ground.

The original IBM-PC’s parallel port had a total of 12 digital outputs and 5 digital inputs accessed via 3 consecutive 8-bit ports in the processor’s I/O space.

Pin out:

Pin description:

You can not directly access the parallel port in windows xp, vista etc due to the security purpose. To access the port do the following:
1. first go to the BIOS setting.
2. then select advanced option.
3. under this option select peripheral configuration
4. then change the setting of parallel port as
a. enable
b. bi-diractional
c. IRQ-7
After doing these steps download the user port and follow the instructions. A window will open, when you will run userport.exe, asking the range.

To find this:
  1. right click on my computer icon
  2. select manage
  3. from device manager select ports(com &LPT)
  4. double click on printer port
  5. a window will open, choose the resources tab you will find

Fill this range in both the spaces and then click on add button. Then click on start button three times, a message will appear just click ok.
Now your port is ready for interfacing.

Tutorial one:
LED Chaser:
  • Connect 8 LEDs to the data port of the parallel port as shown in the figure.

  • Connect ground to pin # 25.
  • Copy and paste the assembly program link it (in MASM) & create .exe file.
  • This program is basically LED chaser in which LEDs blink from left to right when you press ‘r’ and from right to left when you press ‘l’. to off these LEDs just press ‘ 0’ and ‘Esc’ button to exit.

Assembly code:

.model small
.stack 100h
msg db 13,10,'Press r for right movement',13,10,'Press l for left movement',13,10, 'Press 0 to Off',13,10, 'Press Esc to exit','$'
main proc
mov ax,@data
mov ds,ax
mov ah,09h
lea dx,msg
int 21h
set: mov al, 0ffh
mov dx, 378h
out dx,al
call delay
call delay
call delay
mov al,00h
out dx,al
call delay
call delay
call delay
mov al,10000000b
push ax
push dx
mov ah,06h
mov dl,0ffh
int 21h
cmp al,27
je exit
cmp al,'0'
je off
cmp al,'r'
je loop2
pop dx
pop ax
ror al,1
ror al,1
out dx,al
call delay
call delay
jmp lop1
mov dx,378h
mov al,01h
strt: out dx,al
call delay
call delay
rol al,1
rol al,1
push ax
push dx
mov ah,06h
mov dl,0ffh
int 21h
cmp al,27
je exit
cmp al,'0'
je off
cmp al,'l'
je set
pop dx
pop ax
jmp strt
off: mov al, 0h
mov dx, 378h
out dx, al
exit: mov ax, 4c00h
int 21h
main endp
delay proc
push ax
push dx
mov bx,00h
mov ah,2ch ;To Get System Time
int 21h
mov bh,dl ;Copy seconds into bh reg
getsec: mov ah,2ch
int 21h
cmp bh,dl
jne back ;Jump to back when get 1 sec.
jmp getsec
back: pop dx
pop ax
delay endp
end main

  • Tutorial two:
  • Seven Segment Common Cathode Counter:
  • Common Cathode means all –ve terminals of LEDs are grounded & 1 for on, 0 for off.
  • Connect 8 LEDs to the data port of the parallel port as shown in the figure.

  • 1st construct the table for 7-segment

  • This is basically 7-segment counter & timer in which you can set/reset, and pause it.
  • If any one interested in this, he can ask me about the assembly code of this project.
Enjoy playing with parallel port.